1

i have template that include many function file. in footer.php file wp_footer() load just a menu. how can find which action ruined wp_footer() function.

Edit1:

I looking for some way to find where action added for wp_footer if it possible.

footer file code:

    </div><!-- end wrapper -->

    <!-- END SITE -->



    <?php wp_footer(); ?>



</body>

</html>
6
  • wp_footer() loading everything, which are hooked to wp_footer. what there must be? what you mean with ruined ? any errors? Commented Feb 9, 2018 at 13:48
  • @SamvelAleqsanyan . I think some action remove any script must load by wp_footer and now just simple html menu load on call wp_footer function. Commented Feb 9, 2018 at 13:50
  • Hope you realize how useless for us is the code you shared.. we have no idea of what was done or changed. To such a vague question, all i can answer is: Undo all what you did until it works again. Commented Feb 9, 2018 at 13:50
  • @Kaddath. i khow. The problem is that I did not create template. Commented Feb 9, 2018 at 13:51
  • I see. try to find something like add_action('wp_footer', 'some_functions_names'); in all .php files and check all functions, or something like remove_action('wp_footer', 'some_functions_names'). but it would be fater to disable all plugins and check if the problem caused active theme Commented Feb 9, 2018 at 13:56

3 Answers 3

3

From our discussion: You need to get the list of all functions, which hooked to wp_footer action.

You can use this:

add_action('wp', function () {
    echo '<pre>';
    print_r($GLOBALS['wp_filter']['wp_footer']);
    echo '</pre>';
    exit;
});

The code will output all functions in the array, which hooked to wp_footer action.

Code goes to the functions.php file of active theme/child theme

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I looking for this. :)
2

You can get all scripts or css which are loaded in wp_footer by this code.

add_action( 'wp_footer', 'list_comment_filters' );
function list_comment_filters()
{
    global $wp_filter;
    $comment_filters = array ();
    $h1  = '<h1>Current Comment Filters</h1>';
    $out = '';
    $toc = '<ul>';
    foreach ( $wp_filter as $key => $val )
    {
        if ( FALSE !== strpos( $key, 'comment' ) )
        {
            $comment_filters[$key][] = var_export( $val, TRUE );
        }
    }
    foreach ( $comment_filters as $name => $arr_vals )
    {
        $out .= "<h2 id=$name>$name</h2><pre>" . implode( "\n\n", $arr_vals ) . '</pre>';
        $toc .= "<li><a href='#$name'>$name</a></li>";
    }
    print "$h1$toc</ul>$out";
}

3 Comments

I khow. but my problem about find actions add to wp_footer.
Please use this code in functions.php. It will works.
Thanks. That is what i want.
0

To load code in wp_footer() function you should use wp_footer action. Like

add_action('wp_footer', function(){ /* your code */ });

Find all wp_footer actions and check code each of them.

1 Comment

Thank you for your suggestion, but The problem is that there are many function that require in each other. i looking for some way to find all action that theme add to wp_footer if it possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.