Yoast SEO
Cannot change og_type (5 posts)

  1. sunkast
    Posted 2 years ago #

    WordPress version: 3.5.1
    WordPress SEO version: Latest (not sure where to find it)

    So I attempted to switch over to using WordPress SEO for OpenGraph tags from a different plugin that seems to have issues with WP SEO. But have come up with a couple issues as a result.

    I deactivated the plugin I was using before.

    The first issue is that the og:description is not getting inserted in to any page/post.

    Secondly, the plugin I was using before had the og:type set as article for my homepage. WP SEO wants to set the type as website, but because I was using article as the type previously, Facebook throws a fit. Here is the error that I get from Facebook when I run the debug.

    Cannot change og_type: The object at 'http://www.guysfromqueens.com/' previously had type 'article' and cannot be changed to an object of type 'website' to avoid data corruption of existing actions.

    What would be the best way to fix this?


  2. TheMarque
    Posted 2 years ago #

    I am having the exact same problem in the same situation and would love some help.

  3. sunkast
    Posted 2 years ago #

    Okay so in the API documentation I found this snippet of code:

    function yoast_change_opengraph_type( $type ) {
      if ( is_page( 'X' ) )
        return 'video';
    add_filter( 'wpseo_opengraph_type', 'yoast_change_opengraph_type', 10, 1 );

    I changed the if statement to:

    if ( is_home() )

    Which worked and fixed my problem. But as a result it's leaving every other post/page without an og:type...

    Is there any way to fix this without removing the if statement all together? The homepage is the only page that needs the og:type changed.

  4. manolis09
    Posted 2 years ago #

    What about changing it to:

    if ( is_home() ) {
        return 'video';
    } elseif ( is_single() ) {
        return 'article';
    } else {
        return 'website';

    Have a look at http://codex.wordpress.org/Conditional_Tags and play around with the tags, if you wanna have more types or change them.

  5. boborg
    Posted 2 years ago #

    Also having the issue with og:type previously probably being set as article for front page by a different plugin and now WP Seo sets it to website so Facebook debugger complains.

    Did you fix it?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yoast SEO
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic