WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16245 closed defect (bug) (duplicate)

remove_filter makes filters applied after that useless

Reported by: 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)

comment:1 scribu3 years ago

Related: #9968

comment:2 scribu3 years ago

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

Reproduced with r17312.

Cleaned up the example code slightly.

comment:3 follow-up: scribu3 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

comment:4 in reply to: ↑ 3 ; follow-up: Denis-de-Bernardy3 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. ;-)

comment:5 in reply to: ↑ 4 Denis-de-Bernardy3 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.