WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/23/2012 07:12:04 PM (9 years ago)
Author:
nacin
Message:

Add 'ep_mask' as an argument to the 'rewrite' array for register_post_type() and register_taxonomy(). Keeps 'permalink_epmask' compatible as an argument for post type registrations. Fixes endpoints for category and tag pages. fixes #19275.

File:
1 edited

Legend:

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

    r19734 r19738  
    894894 * - labels - An array of labels for this post type. By default post labels are used for non-hierarchical
    895895 *     types and page labels for hierarchical ones. You can see accepted values in {@link get_post_type_labels()}.
    896  * - permalink_epmask - The default rewrite endpoint bitmasks.
    897896 * - has_archive - True to enable post type archives. Will generate the proper rewrite rules if rewrite is enabled.
    898897 * - rewrite - false to prevent rewrite. Defaults to true. Use array('slug'=>$slug) to customize permastruct;
    899  *     default will use $post_type as slug. Other options include 'with_front', 'feeds', and 'pages'.
     898 *     default will use $post_type as slug. Other options include 'with_front', 'feeds', 'pages', and 'ep_mask'.
    900899 * - query_var - false to prevent queries, or string to value of the query var to use for this post type
    901900 * - can_export - true allows this post type to be exported.
     
    925924        'supports' => array(), 'register_meta_box_cb' => null,
    926925        'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null,
    927         'permalink_epmask' => EP_PERMALINK, 'can_export' => true,
     926        'can_export' => true,
    928927        'show_in_nav_menus' => null, 'show_in_menu' => null, 'show_in_admin_bar' => null,
    929928    );
     
    1000999        if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive )
    10011000            $args->rewrite['feeds'] = (bool) $args->has_archive;
     1001        if ( ! isset( $args->rewrite['ep_mask'] ) ) {
     1002            if ( isset( $args['permalink_epmask'] ) )
     1003                $args->rewrite['ep_mask'] = $args['permalink_epmask'];
     1004            else
     1005                $args->rewrite['ep_mask'] = EP_PERMALINK;
     1006        }
    10021007
    10031008        if ( $args->hierarchical )
     
    10231028        }
    10241029
    1025         $wp_rewrite->add_permastruct($post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'], $args->permalink_epmask);
     1030        $wp_rewrite->add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front'], $args->rewrite['ep_mask'] );
    10261031    }
    10271032
Note: See TracChangeset for help on using the changeset viewer.