Make WordPress Core


Ignore:
Timestamp:
04/11/2022 05:09:53 AM (3 years ago)
Author:
peterwilsoncc
Message:

Posts, Post Types/Taxonomies: Add object type specific registration filters.

Add post type and taxonomy specific registration argument hooks.

Introduces the filters register_{$post_type}_post_type_args and register_{$taxonomy}_taxonomy_args. Introduces the actions registered_post_type_{$post_type} and registered_taxonomy_{$taxonomy}.

Props pbiron, dlh, davidbaumwald, hellofromTonya, milana_cap.
Fixes #53212.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-post-type.php

    r53058 r53126  
    440440         */
    441441        $args = apply_filters( 'register_post_type_args', $args, $this->name );
     442
     443        $post_type = $this->name;
     444
     445        /**
     446         * Filters the arguments for registering a specific post type.
     447         *
     448         * The dynamic portion of the filter name, `$this->name`, refers to the post type key.
     449         *
     450         * @since 6.0.0
     451         *
     452         * @param array  $args      Array of arguments for registering a post type.
     453         *                          See the register_post_type() function for accepted arguments.
     454         * @param string $post_type Post type key.
     455         */
     456        $args = apply_filters( "register_{$post_type}_post_type_args", $args, $this->name );
    442457
    443458        $has_edit_link = ! empty( $args['_edit_link'] );
Note: See TracChangeset for help on using the changeset viewer.