Hello in the “action init” to fairly large function, but I would like to add a filter to modify the vars variables, for example the wordpress post ID. That is to say:

add_action( 'init',function(){
    ///code
    //code

    add_filter( 'query_vars',function($vars){
        $vars[] = array('ID' => $myid);
         return $vars;

    });
});

This is possible?

Read more here: Add a filter inside an action init


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: