Opened 5 years ago
Closed 5 years ago
#7750 closed defect (bug) (duplicate)
the_content()'s hard coded str_replace() should be (re)moved
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Template | Version: | 2.6.1 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I'm using a the_content to add some Javascript to the end of each post. However I'm having an incredibly difficult time doing it due to how the_content() is hard coded:
`function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = ) {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
}`
What purpose does it serve? Do we still need it?
If so, it should be moved to a filter so plugins can hook in after it.
Change History (5)
comment:1
Viper007Bond — 5 years ago
comment:2
Viper007Bond — 5 years ago
Ugh, I really wish I could edit my ticket.
"I'm using a the_content hook to..."
- Milestone changed from 2.8 to 2.7
+1. I tried to add custom HTML code as the "more link", and it would get frustrating because of the replace. I think this should be done for 2.7
comment:5
Viper007Bond — 5 years ago
- Milestone 2.7 deleted
- Resolution set to duplicate
- Status changed from new to closed
Why do I always f'ing forget to search before making a ticket? My apologies.

Er, whoops.
function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') { $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; }There we go.