Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#16245 closed defect (bug) (duplicate)

remove_filter makes filters applied after that useless

Reported by: oddoneout's profile oddoneout Owned by:
Milestone: Priority: normal
Severity: major Version: 3.0.4
Component: Plugins Keywords:
Focuses: Cc:

Description (last modified by scribu)

Here's some codes:

function run_once() {
	remove_filter( current_filter(), __FUNCTION__ );
	return 'test';
}
add_filter( 'foobar', 'run_once' );

function another_filter() {
	return 'test again';
}
add_filter( 'foobar', 'another_filter', 11 );

echo apply_filters( 'foobar', '' );

The result of this is 'test' instead of 'test again'. This might happen with remove_action, I haven't tested that function though.

Change History (5)

#1 @scribu
13 years ago

Related: #9968

#2 @scribu
13 years ago

  • Description modified (diff)
  • Severity changed from normal to major

Reproduced with r17312.

Cleaned up the example code slightly.

#3 follow-up: @scribu
13 years ago

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

Actually, it's the same error as described in #9968

#4 in reply to: ↑ 3 ; follow-up: @Denis-de-Bernardy
13 years ago

Replying to scribu:

Actually, it's the same error as described in #9968

It's actually a completely different problem. But you're welcome to come up with a solution nonetheless if PHP5 allows it. ;-)

#5 in reply to: ↑ 4 @Denis-de-Bernardy
13 years ago

Replying to Denis-de-Bernardy:

Replying to scribu:

Actually, it's the same error as described in #9968

It's actually a completely different problem. But you're welcome to come up with a solution nonetheless if PHP5 allows it. ;-)

Woops, my bad. The joys of using tabbed-browsing and reading the wrong window. Never mind that. It's the same one indeed. :-D

Note: See TracTickets for help on using tickets.