Make WordPress Core

Opened 7 years ago

Closed 4 years ago

#17993 closed feature request (wontfix)

the_content vs get_the_content

Reported by: merlinox Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2
Component: Template Keywords: close 2nd-opinion
Focuses: Cc:


Wordpress lacks of a main function: obtain full formatted "content" without echo! Maybe good to add a param to the_content() like echo(bool)?

I wrote it:

function the_content_noecho($more_link_text = null, $stripteaser = 0) {
       $content = get_the_content($more_link_text, $stripteaser);
       $content = apply_filters('the_content', $content);
       $content = str_replace(']]>', ']]>', $content);
       return $content;

Change History (4)

#1 @SergeyBiryukov
7 years ago

  • Keywords close 2nd-opinion added

I don't think we need a wrapper for something that can be done with a couple of lines and is documented in Codex: http://codex.wordpress.org/Function_Reference/the_content#Alternative_Usage

Suggest wontfix.

Last edited 6 years ago by SergeyBiryukov (previous) (diff)

#2 @mdgl
6 years ago

The problem is that those 3 lines have to be replicated in literally thousands of plugins/themes! This is wasteful and error prone as well as creating even more fragile dependencies between those plugins/themes and core.

If WP wants to be a grown-up CMS, I would argue that it really needs a simple, obvious and foolproof way for extensions to obtain important things like "the_content" and "the_excerpt" that include all of the processing that WP intends to be applied (e.g. wpautop, texturize and so on). Of course these also need to be easily and *predictably* customisable by themes/plugins where necessary.

We have dozens of related tickets that would benefit from some simplicity and consistency here. In my humble opinion, WP would benefit greatly from a serious look at "hardening" the API between themes/plugins and core in this way. It's not bad, but becoming increasingly fragile and I think in need of a bit of love and attention!

#3 @iseulde
5 years ago

  • Component changed from Formatting to Template

#4 @helen
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

No huge demand, and I agree with Sergey.

Note: See TracTickets for help on using tickets.