Object type specific registration hooks in 6.0

If you’ve ever worked with post types in WordPress, chances are you’ve used register_post_type_args filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. where you had to perform post type check. In WordPress 6.0 you won’t have to do that any more as new object type hooksHooks In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same. are introduced.

Similar to other dynamic hooks, these will allow you to directly hook into your custom post types and custom taxonomies.

New filters:

  • register_{$post_type}_post_type_args – Filters the arguments for registering a specific post type.
  • register_{$taxonomy}_taxonomy_args – Filters the arguments for registering a specific taxonomyTaxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies..

New actions:

  • registered_post_type_{$post_type} – Fires after a specific post type is registered.
  • registered_taxonomy_{$taxonomy} – Fires after a specific taxonomy is registered.

For more info see #53212.

#6-0, #dev-notes, #dev-notes-6-0