• My theme already includes the necessary meta tags. This plugin is adding duplicate meta tags. Furthermore, for some stupid reason it is adding an og:image for each image I have in the content of my text, which I don’t want!

    The og:image I want is specifically the featured image, which my theme takes care of anyway. Is there some hook or something which I can hook into to disable this behaviour?

    https://www.ads-software.com/plugins/facebook/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jbx

    (@jbx)

    For those looking for a quick fix for this, you can edit facebook.php and comment out this line 465:

    // add_action( 'wp_head', array( 'Facebook_Open_Graph_Protocol', 'add_og_protocol' ) );

    Obviously the moment you update the plugin this will come back, so you have to keep an eye on that, given that they didn’t give us the option to disable it from admin.

    A work around we are using is adding in the functions.php file of the active theme the following code:

    class Facebook_Open_Graph_Protocol {
    	//do nothing
    }

    Adding the class in the functions.php file of the active theme makes the Facebook plugin not add the og metadata, because Facebook checks if the class class Facebook_Open_Graph_Protocol already exists:

    if ( ! class_exists( 'Facebook_Open_Graph_Protocol' ) )
    require_once( $this->plugin_directory . 'open-graph-protocol.php' );
    add_action( 'wp_head', array( 'Facebook_Open_Graph_Protocol', 'add_og_protocol' ) );

    And if it exists it doesn’t add the data from open-graph-protocol.php.

    It is documented somewhere – there is a specific hook you can use to turn off the production of OG tags for this plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I stop this plugin from adding meta tags?’ is closed to new replies.