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/tests/phpunit/tests/taxonomy.php

    r52389 r53126  
    222222    }
    223223
     224
     225    /**
     226     * @ticket 53212
     227     */
     228    public function test_register_taxonomy_fires_registered_actions() {
     229        $taxonomy = 'taxonomy53212';
     230        $action   = new MockAction();
     231
     232        add_action( 'registered_taxonomy', array( $action, 'action' ) );
     233        add_action( "registered_taxonomy_{$taxonomy}", array( $action, 'action' ) );
     234
     235        register_taxonomy( $taxonomy, 'post' );
     236        register_taxonomy( 'random', 'post' );
     237
     238        $this->assertSame( 3, $action->get_call_count() );
     239    }
     240
    224241    /**
    225242     * @ticket 11058
Note: See TracChangeset for help on using the changeset viewer.