Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Could you send me the link to your code where you call is_humans()?

    Thread Starter Steven Vachon

    (@prometh)

    A link wouldn’t do you any good as the only thing on the page is the error mentioned above. This is the erroneous code:

    if (function_exists('is_admin'))
    {
    	$is_humans = (!function_exists('is_humans')) ? false : is_humans();
    
    	if (!is_admin() && !$is_humans)
    	{
    		add_action('template_redirect', 'wp_html_compression_start', -1);
    
    		// In case above fails (it does sometimes.. ??)
    		add_action('get_header', 'wp_html_compression_start');
    	}
    }

    If I comment out the $is_humans line, it works without error; however, humans.txt gets compressed.

    Plugin Author Till Krüss

    (@tillkruess)

    You’re calling is_humans() before $wp_query is initialized. The earliest you can call it, is with the setup_theme action, that’s when the WordPress Object $wp = new WP(); has been initialized in wp-settings.php.

    Best thing to do in your case is to call is_humans() in your wp_html_compression_start(), the template_redirect action is perfect for that.

    Thread Starter Steven Vachon

    (@prometh)

    Ahh, ok. I rarely work with the wp database, and never work with any other dbs; not my thing.

    Thanks for the suggestion; I’ll do that!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘error using is_humans()’ is closed to new replies.