WordPress.org

Forums

Google authorship for multiple authors
[FIX] Plugin breaks single templates (1 post)

  1. meloniq
    Member
    Posted 1 year ago #

    Plugin: http://wordpress.org/plugin/google-authorship-for-multiple-writers

    To fix replace following code:

    add_action('single_template', 'google_authorship_single');
    function google_authorship_single() {
    	global $google_authorship_single;
    	$google_authorship_single = true;
    }

    with:

    add_filter( 'single_template', 'google_authorship_single', 10, 1 );
    function google_authorship_single( $template ) {
    	global $google_authorship_single;
    	$google_authorship_single = true;
    
    	return $template;
    }

    But the best would be to replace usage of global $google_authorship_single with conditional tag is_singular() in functions that needs this information.

    Why?! 'single_template' is a filter hook and not an action hook - so, it must return value

    https://wordpress.org/plugins/google-authorship-for-multiple-writers/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Google authorship for multiple authors
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.