• Hi,

    When troubleshooting a client’s site, I stumbled upon a PHP warning that may be good for you to handle:

    PHP Warning: Undefined variable $open_graphite_head in .../public_html/wp-content/plugins/open-graphite/_open_graphite.php on line 619

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • It’s a path through ‘openghead()’ that doesn’t initialize $open_graphite_head.

    /* Open Graph Ouput into <head> */
    add_action('wp_head', 'openghead', $output_priority);
    function openghead() {
    
      /* Homepage */
      if ( is_home() || is_front_page() ) {
    
        $open_graphite_head = '
    <!--/ Open Graphite Start /-->
    <!--/ Open Graphite End /-->' . "\n\n";
    
      /* Other pages, posts and custom post types */
      } else {
        if (isset($ogoptions['post_types']) && in_array(get_post_type(), $ogoptions['post_types']) || class_exists( 'WooCommerce' )) {
    
          $open_graphite_head = '
    <!--/ Open Graphite /-->
    <!--/ Open Graphite End /-->' . "\n\n";
        }
        /*****  This point allows $open_graphite_head to be unset if:
                  is_home() == false
                  is_front_page() == false
                  class_exists( 'WooCommerce' ) == false
                  isset($ogoptions['post_types']) == false --OR-- in_array(get_post_type(), $ogoptions['post_types']) == false
        *****/
      }
    
      echo $open_graphite_head;
    }
    

    Plugin Author Michael Ott

    (@mikeyott)

    Apologies for the late response. This is now sorted.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Undefined variable’ is closed to new replies.