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

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

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

Line 
1Index: wp-includes/post-template.php
2===================================================================
3--- wp-includes/post-template.php       (revision 21850)
4+++ wp-includes/post-template.php       (working copy)
5@@ -188,6 +188,13 @@
6        $output = '';
7        $hasTeaser = false;
8 
9+       // Only disable <!--more--> tag if we're displaying the is_single post itself
10+       $show_full_content = $more;
11+       if ( is_single() OR is_page() ) {
12+               if ($post->ID != get_queried_object_id())
13+                       $show_full_content = false;
14+       }
15+       
16        // If post password required and it doesn't match the cookie.
17        if ( post_password_required() )
18                return get_the_password_form();
19@@ -208,11 +215,11 @@
20        if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) )
21                $stripteaser = true;
22        $teaser = $content[0];
23-       if ( $more && $stripteaser && $hasTeaser )
24+       if ( $show_full_content && $stripteaser && $hasTeaser )
25                $teaser = '';
26        $output .= $teaser;
27        if ( count($content) > 1 ) {
28-               if ( $more ) {
29+               if ( $show_full_content ) {
30                        $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
31                } else {
32                        if ( ! empty($more_link_text) )