WordPress.org

Make WordPress Core

Ticket #44270: 44270.1.patch

File 44270.1.patch, 1.9 KB (added by ryanshoover, 3 years ago)

Changes rewrite parameter to the default of publicly_queryable

  • wp-includes/class-wp-post-type.php

    diff --git a/wp-includes/class-wp-post-type.php b/wp-includes/class-wp-post-type.php
    index ba37a02fb5..143fe0a899 100644
    a b final class WP_Post_Type { 
    398398                        'register_meta_box_cb'  => null,
    399399                        'taxonomies'            => array(),
    400400                        'has_archive'           => false,
    401                         'rewrite'               => true,
     401                        'rewrite'               => null,
    402402                        'query_var'             => true,
    403403                        'can_export'            => true,
    404404                        'delete_with_user'      => null,
    final class WP_Post_Type { 
    418418                        $args['publicly_queryable'] = $args['public'];
    419419                }
    420420
     421                // If not set, default to the setting for publicly_queriable.
     422                if ( null === $args['rewrite'] ) {
     423                        $args['rewrite'] = $args['publicly_queryable'];
     424                }
     425
    421426                // If not set, default to the setting for public.
    422427                if ( null === $args['show_ui'] ) {
    423428                        $args['show_ui'] = $args['public'];
  • wp-includes/post.php

    diff --git a/wp-includes/post.php b/wp-includes/post.php
    index 7feb284e85..35e1237f67 100644
    a b function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) 
    12481248 *                                              $rewrite is enabled. Default false.
    12491249 *     @type bool|array  $rewrite              {
    12501250 *         Triggers the handling of rewrites for this post type. To prevent rewrite, set to false.
    1251  *         Defaults to true, using $post_type as slug. To specify rewrite rules, an array can be
    1252  *         passed with any of these keys:
     1251 *         Defaults to value of $publicly_queryable, using $post_type as slug. To specify rewrite rules,
     1252 *         an array can be passed with any of these keys:
    12531253 *
    12541254 *         @type string $slug       Customize the permastruct slug. Defaults to $post_type key.
    12551255 *         @type bool   $with_front Whether the permastruct should be prepended with WP_Rewrite::$front.