WordPress.org

Make WordPress Core

Ticket #21894: fix-more-tag-599068.diff

File fix-more-tag-599068.diff, 1.1 KB (added by jeremyclarke, 2 years ago)

fix more tag in get_the_content() in wp-includes/post-template.php

  • wp-includes/post-template.php

     
    188188        $output = ''; 
    189189        $hasTeaser = false; 
    190190 
     191        // Only disable <!--more--> tag if we're displaying the is_single post itself 
     192        $show_full_content = $more; 
     193        if ( is_single() OR is_page() ) { 
     194                if ($post->ID != get_queried_object_id()) 
     195                        $show_full_content = false; 
     196        } 
     197         
    191198        // If post password required and it doesn't match the cookie. 
    192199        if ( post_password_required() ) 
    193200                return get_the_password_form(); 
     
    208215        if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) ) 
    209216                $stripteaser = true; 
    210217        $teaser = $content[0]; 
    211         if ( $more && $stripteaser && $hasTeaser ) 
     218        if ( $show_full_content && $stripteaser && $hasTeaser ) 
    212219                $teaser = ''; 
    213220        $output .= $teaser; 
    214221        if ( count($content) > 1 ) { 
    215                 if ( $more ) { 
     222                if ( $show_full_content ) { 
    216223                        $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1]; 
    217224                } else { 
    218225                        if ( ! empty($more_link_text) )