Make WordPress Core

Ticket #53212: 53212.diff

File 53212.diff, 1.3 KB (added by pbiron, 4 years ago)
  • src/wp-includes/class-wp-post-type.php

    From d68faa7cc79eb5c8db01d26a865ac67fa58b4634 Mon Sep 17 00:00:00 2001
    From: Paul Biron <paul@sparrowhawkcomputing.com>
    Date: Fri, 14 May 2021 16:21:44 -0600
    Subject: [PATCH] Add post_type-specific version of register_post_type_args
     filter.
    
    ---
     src/wp-includes/class-wp-post-type.php | 16 ++++++++++++++++
     1 file changed, 16 insertions(+)
    
    diff --git a/src/wp-includes/class-wp-post-type.php b/src/wp-includes/class-wp-post-type.php
    index 43e8a61514..80cfc1f200 100644
    a b final class WP_Post_Type { 
    412412        public function set_props( $args ) {
    413413                $args = wp_parse_args( $args );
    414414
     415                // Save the post type so that the dynamic filter name below is cleaner.
     416                $post_type = $this->name;
     417
     418                /**
     419                 * Filters the arguments for registering a post type.
     420                 *
     421                 * The dynamic portion of the filter name, `$post_type`, refers to the post
     422                 * type slug.
     423                 *
     424                 * @since x.y.z
     425                 *
     426                 * @param array  $args Array of arguments for registering a post type.
     427                 *                     See the register_post_type() function for accepted arguments.
     428                 */
     429                $args = apply_filters( "register_post_type_{$post_type}_args", $args );
     430
    415431                /**
    416432                 * Filters the arguments for registering a post type.
    417433                 *