Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This might sound weird but this is what really happening to my website. while investing the long delay even before my site starts to load, after searching the source of the problem for a long time i found out that if i remove the wp_footer() from the footer template, the site loads normally. And this delay occurs even if i deactivate all plugins and try loading the site keeping wp_footer() in the template. you can see here in my website: http://www.vps.cadetcollegeblog.com

i would be highly grateful if someone points me the reason for this weird behavior and help resolve it. thanks in advance.

share|improve this question
    
add wp_footer() again and check to see what is loading in the footer there might be js or other files causing this problem. –  Peter May 8 '12 at 6:48
    
wp_footer() is already there. after disabling all plugins i saw the page source and found nothing that has been added via add_footer() and still i got the waiting delay for around 20 seconds. –  xihad May 8 '12 at 7:06
    
check for any actions hooked to your wp_footer in functions.php or any other files included in it, try using some search in files feature like notepad++ it will search all your files for a string search for add_action('wp_footer' and also try double quotes. –  Peter May 8 '12 at 7:17
add comment

1 Answer 1

To debug a hook look into the associated actions and filters. They are listed in $GLOBALS['wp_filter'].

Sample plugin for debugging

<?php # -*- coding: utf-8 -*-
/**
 * Plugin Name: T5 Debug Hook
 * Description: Adds a list of registered filters and action for a hook. Call a page with <code>?hook=NAME</code> to see it.
 */

add_action( 'shutdown', 't5_debug_hook' );

function t5_debug_hook()
{
    if ( ! isset ( $_GET['hook'] ) or ! current_user_can( 'update_core') )
    {
        return;
    }

    $f = $GLOBALS['wp_filter'];

    if ( ! isset ( $f[ $_GET['hook'] ] ) )
    {
        print 'Nothing found for ' . esc_html( $_GET['hook'] );
        return;
    }

    print '<pre>' . esc_html( var_export( $f[ $_GET['hook'] ], TRUE ) ) . '</pre>';
}

Sample output for example.com/?hook=wp_footer

array (
  20 => 
  array (
    'wp_print_footer_scripts' => 
    array (
      'function' => 'wp_print_footer_scripts',
      'accepted_args' => 1,
    ),
  ),
  1000 => 
  array (
    'wp_admin_bar_render' => 
    array (
      'function' => 'wp_admin_bar_render',
      'accepted_args' => 1,
    ),
  ),
)

The numbers (20 and 1000 here) stand for the priority or the order of execution.

Now you can deactivate single actions and filters until you find the slowest.

remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );

… will deactivate the last function.

Your site is rendering fine for me, so I guess it is the admin bar or a script loaded for logged in users only.

share|improve this answer
    
thank you very much! I tried your plugin and removed all the hooks individually. but it didnt help. still there is a long delay before anything starts to load. then i removed all action together. but still didnt work. interestingly i couldn't remove this hook(wp_get_footer_meta) by applying: remove_action( 'wp_footer', 'wp_get_footer_meta', 10 ); it still appears after applying the remove-action you didn't see the delay because that time wp_footer() was omitted from the footer template. even if i deactivate all plugins it still gives a delay. everything seems fine only when i remove it. –  xihad May 8 '12 at 14:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.