Social media OG data support

#701516
  • Resolved Eutimes
    Rank Math free

    Please add OG data support in the Rank Math plugin like AIOSEO has for example and the ability for Facebook and Twitter share posts to extract image from custom fields. Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello, we apologize for the inconvenience you’re facing. We appreciate your feedback and understand the importance of Open Graph (OG) data support for social media sharing.

    Rank Math already has built-in support for Facebook Open Graph tags, which automatically sets up appropriate tags for each post that you write. This includes adding a custom title, description, and image, as well as automatically generating social media images. Additionally, Rank Math’s social meta box allows you to customize Twitter card types and use data from Facebook to the Twitter tab.

    If you have any specific questions about how to configure or use these features, please feel free to ask.

    Sources:
    The #1 WordPress SEO Plugin in 2023 – Rank Math
    Social Media Options in Rank Math
    Analyzing Your Site’s SEO with Rank Math’s SEO Analysis Tool

    I am interested to know if a future update will bring the option to add open graph images from custom fields like AIOSEO does for example. Thank you.

    Hello,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    We do have a way to do that, it may require a filter code. Here’s that filter code:

    add_filter( 'rank_math/opengraph/facebook/image', function( $attachment_url ) {
    	global $post;
    	if(get_field('YOUR_FIELD_NAME', $post->ID)){
    		$attachment_url = get_field('YOUR_FIELD_NAME', $post->ID);
    	}
    	return $attachment_url;
    });
    add_filter( 'rank_math/opengraph/twitter/image', function( $attachment_url ) {
    	global $post;
    	if(get_field('YOUR_FIELD_NAME', $post->ID)){
    		$attachment_url = get_field('YOUR_FIELD_NAME', $post->ID);
    	}
    	return $attachment_url;
    });

    You may refer to this guide on how to add filters to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let me know if that helps.

    Thank you and where should this filter code be added? Hopefully though such an option will be implemented in the plugin’s settings in future updates as it would make it easier for most users.

    Hello,

    You can add this code to your child theme’s function.php or rank-math.php file. You can learn more about these and more options here: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Thank you for choosing Rank Math

    Thank you so much for the answer and this is great that it can be done with code. We’ve tried it and it works. Is there any chance that this will be implemented in the settings though? Working with codes is counterintuitive for most users. Thank you.

    Hello,

    We’re glad to hear that the code is working fine for you. At this time, this can only be achieved using our filters, although that might change in the future. Thank you for the feedback and suggestions!

    I’m closing this ticket now but if you ever have another question or need any help in the future, please don’t hesitate to create a new forum topic. We’ll be more than happy to assist you again.

    Thank you for choosing Rank Math and have a wonderful day!

Viewing 7 replies - 1 through 7 (of 7 total)

The ticket ‘Social media OG data support’ is closed to new replies.