[wp-trac] [WordPress Trac] #25349: Can't retrieve calculated excerpt bound by <!--more--> on single page view

WordPress Trac noreply at wordpress.org
Mon Nov 17 16:53:56 UTC 2014


#25349: Can't retrieve calculated excerpt bound by <!--more--> on single page view
-------------------------------------+-----------------------------
 Reporter:  chriscoyier              |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Posts, Post Types        |     Version:  3.6.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  template
-------------------------------------+-----------------------------

Comment (by boonebgorges):

 > Since the $more global is pulled in on line 4547, I just assumed that
 this represented the $more global I'm familiar with in the templates. Are
 you sure that's not what's getting modified here?

 The `<!--more-->` *tag* is a bit of text that's entered by post authors to
 indicate a distinction between the "teaser" text - always displayed - and
 the "body" text - displayed only when full content is requested.

 The `$more` *global* is, technically, an override for `<!--more-->`. If
 it's set to 1, then the entire post content is displayed, regardless of
 the `<!--more-->` tag. So they're closely related, but not the same thing.

 I'm on the fence about what to do here. You may be right that plenty of
 plugins/themes are manipulating `$more` in order to perform an override
 like you're doing, and while it's not difficult to modify your own plugin
 to do the `$more` toggle after `setup_postdata()`, it'd be nice to avoid
 it.

 One thought I had is to put the `$more` logic of `setup_postdata()` inside
 of an `if ( $this->is_main_query() )` block. The thinking is that the only
 time core would want to force all content to be shown would be during the
 main `$wp_query` loop, and we can let plugins do whatever they want with
 secondary loops. The good thing about this is that I think it would fix
 your particular plugin and others like it, while maintaining the current
 `<!--more-->` behavior in core. The bad thing is that it will block
 plugins/themes from forcing `$more` for the main loop, though maybe this
 is a more acceptable break, if only because it's more rare. Do you have
 thoughts about it?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/25349#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list