[wp-trac] [WordPress Trac] #42958: create callers for loop functions to accept post id

WordPress Trac noreply at wordpress.org
Tue Nov 17 05:49:22 UTC 2020


#42958: create callers for loop functions to accept post id
-------------------------+------------------------------
 Reporter:  tazotodua    |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  2nd-opinion  |     Focuses:
-------------------------+------------------------------
Changes (by helen):

 * keywords:   => 2nd-opinion
 * type:  defect (bug) => enhancement


Comment:

 `get_the_content()` does at least have a `$post` parameter now, see
 #42814.

 Specific to the proposal in the body of the ticket, I am not a big fan of
 adding faux-private functions like `_the_content()` and also think it's
 unwise to open up functions that are specific to The Loop to non-loop
 contexts without further examination of the underlying problem. So while I
 can imagine some use cases and problems this relates to, I'd like to start
 with understanding your particular scenarios where you need to get front-
 end formatted post content outside of a loop context, so any descriptions
 you're willing to provide will help move us toward possible solutions.

 It seems to me that there is kind of a broader issue in WordPress about
 how to retrieve consistently formatted content for a specific context
 without directly applying filters yourself. There are excerpts and feeds
 and block editor and widgets and so on, all of which might want to
 retrieve the same post content but treat it in a different way. That's
 currently indicator by the different filter to be applied, but depending
 on what things we're solving for maybe it does make sense to add some kind
 of API for consistent retrieval.

 I thought for sure this must be a duplicate request as it seems like the
 kind of thing people would probably be looking to do more regularly but I
 was unable to find one.

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


More information about the wp-trac mailing list