Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #42814, comment 64


Ignore:
Timestamp:
11/05/2018 08:11:36 AM (6 years ago)
Author:
rogerlos
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #42814, comment 64

    initial v1  
    33The reason: I want WordPress to apply the filters normally applied to post_content to the post my code has grabbed in hopes of "normalizing" my function's output to match other content on the site.
    44
    5 This is also tricky in that `get_the_excerpt` does not fail if there is content in `post_excerpt`. I call `get_the_excerpt` often in hopes that I get back content even if `post_excerpt` is empty via its "grab some post content if excerpt is empty" feature.
     5This is also tricky in that `get_the_excerpt` does not fail if there is content in `post_excerpt`. I call `get_the_excerpt` sometimes in hopes that I get back content even if `post_excerpt` is empty via its "grab some post content" feature.
    66
    77My opinion, worth exactly what you're paying for it, is that there ideally should not be any "within the loop" only functions, just like there should be no functions which ''only'' `echo` content without option to get back the results...
     8
     9Edited to add that I've been doing this for years, mind you without having read every line of WP's source, but I've always had the (mistaken) understanding that `get_the` functions exist specifically to get desired content outside of the loop context. The `get_the` naming does lend itself to my interpretation, though.