1
votes

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>
3
wp_footer() loading everything, which are hooked to wp_footer. what there must be? what you mean with ruined ? any errors? - Samvel Aleqsanyan
@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. - Saman
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. - Kaddath
@Kaddath. i khow. The problem is that I did not create template. - Saman
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 - Samvel Aleqsanyan

3 Answers

3
votes

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

2
votes

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";
}
0
votes

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.