0

It is possible and a good practice to combine filters and actions, it is necessary to take into account the order in which they are executed, a graphic example https://images.app.goo.gl/zSCcfuMNTEm5wj7n8

Here I show you the example of the code I want to make:

Action parent + Filter child

add_action( "init", "parent_action");
function parent_action()
{
    add_filter( "any", "child_filter");
    function child_filter() 
    {

    }
}

Action parent + Action child

add_action( "init", "parent_action");
function parent_action()
{
    add_action( "any", "child_action");
    function child_action() 
    {

    }
}
  • Yes, WordPress does support nested hooks. And my answer here might help you. – Sally CJ Sep 8 '19 at 1:59
  • 1
    Perfect, thank you very much. – Learning and sharing Sep 9 '19 at 2:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.