WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#7166 closed enhancement (wontfix)

get_the_content vs the_content

Reported by: christian@… Owned by: jacobsantos
Milestone: Priority: normal
Severity: normal Version: 2.6
Component: General Keywords: has-patch needs-testing dev-feedback 2nd-opinion
Focuses: Cc:

Description

the_content applies a filter before echoing the content from get_the_content - I suggest adding a method return_the_content which does the same as get_the_content - except returning the result by value rather than using echo to print it.

Attachments (1)

content_and_excerpt_return.patch (1.2 KB) - added by christian@… 7 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 @christian@…7 years ago

  • Keywords has-patch needs-testing added

content_and_excerpt_return.patch is against wordpress-2.5.1.

comment:2 @DD327 years ago

  • Keywords dev-feedback 2nd-opinion added
  • Version set to 2.6

I personally think that If you want it with the filters applied, You should just use:

$content = apply_filters('the_content',get_the_content($more_link_text, $stripteaser, $more_file));

comment:3 @Viper007Bond7 years ago

I agree with DD32.

-1 to this patch.

comment:4 @santosj7 years ago

  • Owner changed from anonymous to jacobsantos

comment:5 @santosj7 years ago

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

comment:6 @magblogapi5 years ago

  • Version changed from 2.6 to 2.9.1

How about making that a bit clearer in the docs?

I just spent two days slamming my head into a brick wall over this very simple issue.

I agree with the way the issue was resolved, but it would be great if I didn't have to dive into Trac to find it. Just add a quick description of this in the docs for the function.

comment:7 @nacin5 years ago

  • Version changed from 2.9.1 to 2.6

I agree with the way the issue was resolved, but it would be great if I didn't have to dive into Trac to find it. Just add a quick description of this in the docs for the function.

Anyone can update the Codex.

Note: See TracTickets for help on using tickets.