Make WordPress Core


Ignore:
Timestamp:
10/26/2010 07:12:06 AM (16 years ago)
Author:
nacin
Message:

Allow page rewrites to be disabled. see #13818.

File:
1 edited

Legend:

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

    r15937 r15970  
    862862 * - has_archive - True to enable post type archives. Will generate the proper rewrite rules if rewrite is enabled.
    863863 * - rewrite - false to prevent rewrite. Defaults to true. Use array('slug'=>$slug) to customize permastruct;
    864  *     default will use $post_type as slug. Other options include 'with_front' and 'feeds'.
     864 *     default will use $post_type as slug. Other options include 'with_front', 'feeds', and 'pages'.
    865865 * - query_var - false to prevent queries, or string to value of the query var to use for this post type
    866866 * - can_export - true allows this post type to be exported.
     
    949949                if ( ! isset( $args->rewrite['with_front'] ) )
    950950                        $args->rewrite['with_front'] = true;
     951                if ( ! isset( $args->rewrite['pages'] ) )
     952                        $args->rewrite['pages'] = true;
    951953                if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive )
    952954                        $args->rewrite['feeds'] = (bool) $args->has_archive;
     
    965967                                $wp_rewrite->add_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
    966968                        }
    967                         $wp_rewrite->add_rule( "{$archive_slug}/page/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
     969                        if ( $args->rewrite['pages'] )
     970                                $wp_rewrite->add_rule( "{$archive_slug}/page/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
    968971                }
    969972
Note: See TracChangeset for help on using the changeset viewer.