WordPress version: 3.5
WordPress SEO version: 22.214.171.124
I have one custom post type that is loading data from external API and is not using integrated post thumbnail. I’m trying to override the og:image and twitter:image tags (I have default images set).
I have found a very useful filter “wpseo_opengraph_image” in the source code, but there is “bug” or inconsistency between “class-opengraph.php” and “class-twitter.php”.
Opengraph class is trying to fetch image from post_thumbnail, then load default and then it is applying the filter, so image can be rewritten in all cases.
Twitter class is first doing the check if post_thumbnail exists and then rewrite can be applied to override the post_thumbnail, but if no post thumbnail exists, class will use the default image without using the filter “wpseo_opengraph_image”, so no rewrite option exists.
If there is no post_thumbnail, “wpseo_opengraph_image” filter is working on open graph tag, but is not working on twitter:image tag.
This is not a show-stopper and I can “fix” the code for now.
Please try to look at it, it seems, that opengraph class is newer then twitter class 😉
- The topic ‘filter "wpseo_opengraph_image" Twitter VS Facebook inconsistency’ is closed to new replies.