Custom Post Types won’t show in Posts block
-
You are using the
getPostTypes
function from the core package and by default it has pagination enabled. Because of this, when post type select loads the post types it can only show the post types withviewable=true
in the first 10 results. If there is another custom post types which are publicly queryable they won’t show in the select box.@bastho and @heisel respectively created two1 2 similar topics in the past. None of them got a response. @bastho even provided the fix;
It can be easily fixed by removing the implicit limit in gutenberg/components/post-type-selector-control/index.jsx line 60
replace:
const postTypes = getPostTypes();
by:
from @bastho’s support request.const postTypes = getPostTypes({ per_page: -1 });
Or, for a better solution you can use
usePublicPostTypes
from Gutenberg project. Here it is.Cheers!
- The topic ‘Custom Post Types won’t show in Posts block’ is closed to new replies.