Ticket #5361: 569_show_on_front.diff

File 569_show_on_front.diff, 842 bytes (added by hailin, 5 years ago)

patch file

  • wp-includes/post.php

     
    504504        $parent_data = array( 'post_parent' => $post->post_parent ); 
    505505        $parent_where = array( 'post_parent' => $postid ); 
    506506 
     507        /* 
     508         * if the page is defined in option page_on_front or post_for_posts,  
     509         * adjust the corresponding options 
     510         */ 
     511        if ('page' == $post->post_type){ 
     512                         
     513                if ($postid == get_option('page_on_front')){ 
     514                        update_option('show_on_front', 'posts'); 
     515                        delete_option('page_on_front'); 
     516                } 
     517                if ($postid == get_option('page_for_posts')){ 
     518                        delete_option('page_for_posts'); 
     519                } 
     520        } 
     521 
    507522        if ( 'page' == $post->post_type ) 
    508523                $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'page' ) ); 
    509524