Make WordPress Core

Opened 10 months ago

Last modified 10 months ago

#60502 new defect (bug)

remove_function method removing next priority action too while removing current priority

Reported by: amritanshatwisetr's profile amritanshatwisetr Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.4.3
Component: General Keywords:
Focuses: Cc:

Description

add_action('my_custom_hook', 'mycustomfunc1',9); 
add_action('my_custom_hook', 'mycustomfunc2',99); 
add_action('my_custom_hook', 'mycustomfunc3',100);


function mycustomfunc1(){
    echo 'mycustomfunc1 <br/>';
}

function mycustomfunc2() {
    echo 'mycustomfunc2  <br/>';
    remove_action('my_custom_hook', 'mycustomfunc2',99);
}

function mycustomfunc3() {
    echo 'mycustomfunc3 <br/>';
}


add_action('wp', function(){

    do_action('my_custom_hook');
    exit;
});

Hi everyone, I found a strange behaviour from the WP core related to remove_action, here when we are removing mycustomfunc2 and the mycustomfunc3 automatically getting removed generating output like this-
https://imgur.com/Y3aMVfF
Appreciate if this being checked, initially it seems to be a clear bug.
I can ensure I am using WP version 6.4.3 with no change in core files.

Change History (1)

#1 @chris@…
10 months ago

As far as I can tell, this appears to be a duplicate of https://core.trac.wordpress.org/ticket/40685

Version 0, edited 10 months ago by chris@… (next)
Note: See TracTickets for help on using tickets.