og-images / custom post type

#113898
  • Resolved Sascha
    Rank Math free

    Hi there,

    Rank Math is using the default og-image for all pages and posts.
    How can I force Rank Math to use each posts’ image as og-image (custom post type)?

    Thanks in advance,

    Sascha

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Thank you so much for getting in touch.

    You can use this filter in your theme’s functions.php file to force the use of default OpenGraph image instead of the first image in the content:

    add_filter('rank_math/opengraph/pre_set_content_image', function() {
    	return true;
    });

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Sascha
    Rank Math free

    Hi Uzair,

    Thanks for your reply.
    I think there’s a misunderstanding.
    I want to use the posts’ image. But after installing Rank Math all pages are using the default og image I defined in Rank Math.

    Regards,
    Sascha

    Sascha
    Rank Math free

    Thank you! Problem fixed!

    Hello,

    We glad to be of help and happy that the issue is resolved.

    If you need further help or with anything else, please open a new support ticket here so we can help

    We are always here for assistance.

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

The ticket ‘og-images / custom post type’ is closed to new replies.