-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Twitter image url is not passed to filter for other (plugin) filter hooks #15523
Comments
Hi @vasvir, I am not really sure what you're expecting here. If I explicitly set a twitter image on a post, then the We do not output a |
Hi @Djennez, thanks for looking at it. I may have been confused a bit. I assume that twitter:image must have the same behavior as og:image. If that assumption is not true then I have misunderstood the scope of the filter and I apologize. My understanding is that og:image meta tag is outputted event if a og:image is not explicitly set (in Yoast settings of the post/page) The wpseo_opengraph_image filter outputs a url if og:image has been set but it also outputs a url if the feature image of the post has been set. So my understanding was that the twitter filter should do the same. |
@vasvir I've checked this with the PO's, and this is how it should work / works now:
Does this provide better insights? |
@Djennez thanks for clearing things out. I didn't know that:
Thanks again for the detailed answer. It really provides better insights. |
I'm going to close this thread as I believe all questions have been answered. The filter bug has been brought forwards as a separate issue here |
@vasvir has a valid point and I don't believe this is solved. We use an API to overlay our branding on images and rely heavily on rewriting the meta tags. Our Twitter images stopped showing despite an /**
* Rewrite Yoast SEO open graph image urls
*/
add_filter('wpseo_opengraph_image', 'prepend_api_for_frame'); // returns https://example.com/wp-content/themes/example/api.php?image=URL_TO_IMAGE
add_filter('wpseo_twitter_image', 'prepend_api_for_frame'); // returns empty string https://example.com/wp-content/themes/example/api.php?image=""
function prepend_api_for_frame($url) {
return get_template_directory_uri() . "/wp-content/themes/example/api.php?image=" . $url;
} |
Description of what happened.
Yoast SEO works ok when the FIFU plugin is disabled (Feature Image From URL).
However when FIFU is enabled and not being used (meaning the feature image is a normal image from media library) the apply_filters() function is called with wrong arguments in wordpress-seo/src/presenters/twitter/image-presenter.php:45
Description of what is expected to happen and why.
I am expecting YOAST to pass the current feature image url as specified in wordpress but looks like the necessary info in a indirection step away in the presentation object.
Technical info
The following patch resolves the issue for me. Please note the twitter_image is under model and not directly under presentation.
Used versions
The text was updated successfully, but these errors were encountered: