Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#7750 closed defect (bug) (duplicate)

the_content()'s hard coded str_replace() should be (re)moved

Reported by: viper007bond's profile Viper007Bond Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.6.1
Component: Template Keywords:
Focuses: 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)

#1 @Viper007Bond
17 years ago

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.

#2 @Viper007Bond
17 years ago

Ugh, I really wish I could edit my ticket.

"I'm using a the_content hook to..."

#3 @ShaneF
17 years ago

  • 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

#5 @Viper007Bond
17 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.

Note: See TracTickets for help on using tickets.