WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/28/2012 08:29:33 PM (9 years ago)
Author:
duck_
Message:

Reduce references to the $wp_rewrite global because it's no longer used or a wrapper function can be used instead. Fixes #14546.#14546.

File:
1 edited

Legend:

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

    r19924 r20023  
    10071007
    10081008        if ( $args->hierarchical )
    1009             $wp_rewrite->add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
     1009            add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
    10101010        else
    1011             $wp_rewrite->add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
     1011            add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
    10121012
    10131013        if ( $args->has_archive ) {
     
    10181018                $archive_slug = $wp_rewrite->root . $archive_slug;
    10191019
    1020             $wp_rewrite->add_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
     1020            add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
    10211021            if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
    10221022                $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
    1023                 $wp_rewrite->add_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
    1024                 $wp_rewrite->add_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
     1023                add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
     1024                add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
    10251025            }
    10261026            if ( $args->rewrite['pages'] )
    1027                 $wp_rewrite->add_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
     1027                add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
    10281028        }
    10291029
    1030         $wp_rewrite->add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite );
     1030        add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite );
    10311031    }
    10321032
     
    19621962 */
    19631963function wp_delete_post( $postid = 0, $force_delete = false ) {
    1964     global $wpdb, $wp_rewrite;
     1964    global $wpdb;
    19651965
    19661966    if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
     
    24002400 * @since 1.0.0
    24012401 * @uses $wpdb
    2402  * @uses $wp_rewrite
    24032402 * @uses $user_ID
    24042403 * @uses do_action() Calls 'pre_post_update' on post ID if this is an update.
     
    24132412 */
    24142413function wp_insert_post($postarr, $wp_error = false) {
    2415     global $wpdb, $wp_rewrite, $user_ID;
     2414    global $wpdb, $user_ID;
    24162415
    24172416    $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
Note: See TracChangeset for help on using the changeset viewer.