-
good morning. I continue to have a big problem. even if I have set opengraph you don’t see the images on my site in the links I post on facebook. memtre on linkedig, twitter and other social networks are seen.
-
Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
I have tested some posts on https://developers.facebook.com/tools/debug/ but they seem to have the image you set on them. Could you check it?
Looking forward to helping you. Thank you.
if you try to publish it will not. and you will only see the logo because of the properties
I continue to have a huge problem with rankmath for facebook opengraph. I don’t know what to do anymore and I’m sorry for not being answered.
}
add_filter( ‘wp_resource_hints’, ‘remove_dns_prefetch’, 10, 2 );
remove_action (‘wp_head’, ‘rsd_link’);add_filter( ‘rank_math/opengraph/facebook/image’, ‘rank_math_set_content_image’ );
add_filter( ‘rank_math/opengraph/twitter/image’, ‘rank_math_set_content_image’ );
function rank_math_set_content_image( $attachment_url ) {
if ( $attachment_url || ! is_singular() ) {
return $attachment_url;
}global $post;
if ( has_post_thumbnail() || get_post_meta( $post->ID, ‘rank_math_facebook_image_id’, true ) ) {
return $attachment_url;
}$content = $post->post_content;
$images = [];
if ( preg_match_all( ‘]+>
‘, $content, $matches ) ) {
foreach ( $matches[0] as $img ) {
if ( preg_match( ‘src=(["\'])(.*?)\1
‘, $img, $match ) ) {
if ( isset( $match[2] ) ) {
$images[] = $match[2];
}
}
}
}if ( ! empty( $images ) ) {
return $images[0];
}return $attachment_url;
}this code has been inserted in the functions.php file
Is it probably wrong?
Hello,
I tried again with some recent posts but again, still no luck reproducing the issue as you can see in the screencast I shared in the Sensitive Data section.
I also tried to publish a new one and check the result (as I show you in the second screencast) and it is true that the featured image doesn’t instantly show, I guess because Facebook needs some minutes to scrape the page and get the image and meanwhile it takes the site image.
But as you can see (and test), if you wait some minutes, it will work as you want.
Looking forward to help you.
unfortunately it is not so. the image is shown by facebook. but once the link is published, instead of publishing the preview, a logo is published. and it is not the logo inserted in rankmath.
Hello,
Your media images seem to be 400 x 400 px. Could you please add images with at least 600 x 315 px. The size recommended for Facebook images is actually 1200 X 630 px. Let us how this goes.
Looking forward to helping you. Thank you.
good morning. perhaps I was unclear. every time I publish one of my links on facebook you can see the image. when I send this logo is published instead. that logo is not placed in rankmath. the problem is not the size of the images because everything was fine up to a month ago. I’m asking if there are codes to be entered manually and where but nobody answers.
Hello,
To account for all probable causes of the issue could you please remove the code added in your theme then try to share one of your posts.
Since we cannot replicate the issue from our end, please record a screencast with https://www.loom.com and addthe URL in the sensitive section.
Looking forward to helping you. Thank you.
There is no code. It has been removed. But the previews of the images are not seen in the links on facebook.
What should I do with that link?
I left the data for you to verify.
Hello,
Don’t worry, we will help you to solve the issue. But we will need to find more details about the issue, that is why my colleague asked you to record a screencast with https://www.loom.com/ showing us the issue you have. Could you try to do it and share it with us?
Looking forward to help you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.
The ticket ‘Error facebook.’ is closed to new replies.