-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Description
register_block_core_navigation_link()
of navigation-link
block will use registered post_type
and taxonomy
, then register variations of navigation-link block. It will be done as init
hook with default priority now.
But from functions references
register_post_type()
: Post type registrations should not be hooked before the ‘init’ action.
register_taxnomy()
: Do not use before the ‘init’ hook.
So custom post types and taxonomies may not be registered yet at register_block_core_navigation_link()
doing, and such post type links and taxonomy archive links are not appeared as blocks for navigation menu.
In "Registering Custom Post Types" of "Plugin Handbook", custom post type is registered as init
hook with default priority 10
, so it should be usual timing to register custom post type for plugins , but archive link for such registered post type will not be appeared as blocks. If post types is registered as init
hook with priority 9
, such post types will be appeared.
register_block_core_navigation_link()
should be done after init
hook, or lower priority.
Step-by-step reproduction instructions
- register a custom post type in
init
hook with default priority - add navigation menu in Post Edit admin screen
- in navigation block settings "Menu", try to add block and "Browse all blocks" in left side navi "block inserter"
- registered custom post type is not in "THEMES" blocks.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes