Skip to content

Commit

Permalink
Merge pull request #78 from ryanwelcher/fix/post-include
Browse files Browse the repository at this point in the history
Trim whitespace from title.rendered
  • Loading branch information
ryanwelcher authored Aug 7, 2024
2 parents 1a2ee18 + 1277fe9 commit 7cefb2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/multiple-post-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const MultiplePostSelect = ( { attributes, setAttributes } ) => {

const postTypes = useSelect( ( select ) =>
select( coreStore )
.getPostTypes({ per_page: 50 })
.getPostTypes( { per_page: 50 } )
?.filter( ( { viewable } ) => viewable )
?.map( ( { slug } ) => slug )
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/post-include-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const PostIncludeControls = ( { attributes, setAttributes } ) => {
const getPostId = ( postTitle ) => {
const foundPost =
includePosts.find( ( post ) => post.title === postTitle ) ||
posts.find( ( post ) => post.title.rendered === postTitle );
posts.find( ( post ) => post.title.rendered.trim() === postTitle );

return foundPost.title.rendered
? { id: foundPost.id, title: foundPost.title.rendered }
Expand Down

0 comments on commit 7cefb2b

Please sign in to comment.