WordPress.org

Make WordPress Core

Ticket #18408: 18408.patch

File 18408.patch, 1.3 KB (added by ericlewis, 7 years ago)

.patch file version

  • post.php

     
    401401 * @return object stdClass object containing all the default post data as attributes
    402402 */
    403403function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) {
    404         global $wpdb;
     404        global $wpdb, $wp_query;
    405405
    406406        $post_title = '';
    407407        if ( !empty( $_REQUEST['post_title'] ) )
     
    447447        $post->post_title   = apply_filters( 'default_title',   $post_title, $post   );
    448448        $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post );
    449449        $post->post_name = '';
    450 
     450       
     451        $wp_query->post = $post;
     452       
    451453        return $post;
    452454}
    453455
     
    459461 * @return object stdClass object containing all the default post data as attributes
    460462 */
    461463function get_default_page_to_edit() {
     464        global $wp_query;
     465
    462466        $page = get_default_post_to_edit();
    463467        $page->post_type = 'page';
     468       
     469        $wp_query->post = $page;
     470       
    464471        return $page;
    465472}
    466473
     
    473480 * @return unknown
    474481 */
    475482function get_post_to_edit( $id ) {
    476 
     483        global $wp_query;
     484       
    477485        $post = get_post( $id, OBJECT, 'edit' );
    478486
    479487        if ( $post->post_type == 'page' )
    480488                $post->page_template = get_post_meta( $id, '_wp_page_template', true );
    481 
     489       
     490        $wp_query->post = $post;
     491       
    482492        return $post;
    483493}
    484494