Changeset 53126
- Timestamp:
- 04/11/2022 05:09:53 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-post-type.php
r53058 r53126 440 440 */ 441 441 $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 ); 442 457 443 458 $has_edit_link = ! empty( $args['_edit_link'] ); -
trunk/src/wp-includes/class-wp-taxonomy.php
r53058 r53126 315 315 */ 316 316 $args = apply_filters( 'register_taxonomy_args', $args, $this->name, (array) $object_type ); 317 318 $taxonomy = $this->name; 319 320 /** 321 * Filters the arguments for registering a specific taxonomy. 322 * 323 * The dynamic portion of the filter name, `$this->name`, refers to the taxonomy key. 324 * 325 * @since 6.0.0 326 * 327 * @param array $args Array of arguments for registering a taxonomy. 328 * See the register_taxonomy() function for accepted arguments. 329 * @param string $taxonomy Taxonomy key. 330 * @param string[] $object_type Array of names of object types for the taxonomy. 331 */ 332 $args = apply_filters( "register_{$taxonomy}_taxonomy_args", $args, $this->name, (array) $object_type ); 317 333 318 334 $defaults = array( -
trunk/src/wp-includes/post.php
r53060 r53126 1710 1710 do_action( 'registered_post_type', $post_type, $post_type_object ); 1711 1711 1712 /** 1713 * Fires after a specific post type is registered. 1714 * 1715 * The dynamic portion of the filter name, `$post_type`, refers to the post type key. 1716 * 1717 * @since 6.0.0 1718 * 1719 * @param string $post_type Post type. 1720 * @param WP_Post_Type $post_type_object Arguments used to register the post type. 1721 */ 1722 do_action( "registered_post_type_{$post_type}", $post_type, $post_type_object ); 1723 1712 1724 return $post_type_object; 1713 1725 } -
trunk/src/wp-includes/taxonomy.php
r53058 r53126 529 529 */ 530 530 do_action( 'registered_taxonomy', $taxonomy, $object_type, (array) $taxonomy_object ); 531 532 /** 533 * Fires after a specific taxonomy is registered. 534 * 535 * The dynamic portion of the filter name, `$taxonomy`, refers to the taxonomy key. 536 * 537 * @since 6.0.0 538 * 539 * @param string $taxonomy Taxonomy slug. 540 * @param array|string $object_type Object type or array of object types. 541 * @param array $args Array of taxonomy registration arguments. 542 */ 543 do_action( "registered_taxonomy_{$taxonomy}", $taxonomy, $object_type, (array) $taxonomy_object ); 531 544 532 545 return $taxonomy_object; -
trunk/tests/phpunit/tests/post/types.php
r52389 r53126 162 162 // Should fall back to 'public'. 163 163 $this->assertSame( $public, $args->show_in_admin_bar ); 164 } 165 166 /** 167 * @ticket 53212 168 * @covers ::register_post_type 169 */ 170 public function test_fires_registered_post_type_actions() { 171 $post_type = 'cpt'; 172 $action = new MockAction(); 173 174 add_action( 'registered_post_type', array( $action, 'action' ) ); 175 add_action( "registered_post_type_{$post_type}", array( $action, 'action' ) ); 176 177 register_post_type( $post_type ); 178 register_post_type( $this->post_type ); 179 180 $this->assertSame( 3, $action->get_call_count() ); 164 181 } 165 182 -
trunk/tests/phpunit/tests/post/wpPostType.php
r51404 r53126 217 217 $this->assertSameSets( array(), $taxonomies_after ); 218 218 } 219 220 public function test_applies_registration_args_filters() { 221 $post_type = 'cpt'; 222 $action = new MockAction(); 223 224 add_filter( 'register_post_type_args', array( $action, 'filter' ) ); 225 add_filter( "register_{$post_type}_post_type_args", array( $action, 'filter' ) ); 226 227 new WP_Post_Type( $post_type ); 228 new WP_Post_Type( 'random' ); 229 230 $this->assertSame( 3, $action->get_call_count() ); 231 } 219 232 } -
trunk/tests/phpunit/tests/taxonomy.php
r52389 r53126 222 222 } 223 223 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 224 241 /** 225 242 * @ticket 11058 -
trunk/tests/phpunit/tests/term/wpTaxonomy.php
r52389 r53126 100 100 101 101 } 102 103 public function test_applies_registration_args_filters() { 104 $taxonomy = 'taxonomy5'; 105 $action = new MockAction(); 106 107 add_filter( 'register_taxonomy_args', array( $action, 'filter' ) ); 108 add_filter( "register_{$taxonomy}_taxonomy_args", array( $action, 'filter' ) ); 109 110 new WP_Taxonomy( $taxonomy, 'post' ); 111 new WP_Taxonomy( 'random', 'post' ); 112 113 $this->assertSame( 3, $action->get_call_count() ); 114 } 102 115 }
Note: See TracChangeset
for help on using the changeset viewer.