Opened 14 years ago
Closed 12 years ago
#17993 closed feature request (wontfix)
the_content vs get_the_content
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.2 |
| Component: | Template | Keywords: | close 2nd-opinion |
| Focuses: | Cc: |
Description
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)
#2
@
13 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!
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.