Set Image for social media from custom url instead of media library

  • Dear Team,

    Do you have any hook or filter so we can set custom url for the social media preview image. We want to set featured image for the social media preview image instead of uploading via media lirbary. we are setting featured image using custom url so it will not show in media lib so we do not able to add this image or assign this image to facebook preview image for the social media posts.

    OR any button when user press then it auto set featured image for the Facebook preview image.

    Please have look this image so you will get it: http://prnt.sc/shthjz

    Can you please add this functionality to the next version or in your feature list?

    Regards
    Ashok

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

    Thank you for contacting Rank Math today.

    We don’t have the functionality of adding an image directly from a URL yet. You’d have to load the image manually to your site for now. I’ll however inform the dev team about your suggestion.

    Hope this helps you. Thank you.

    ​​​​​​

    Thank you 🙂

    Hi Ashok,

    Thanks for the follow up.

    Just to add to my previous response, you can also make use of the following filter to load the image URL saved from the featured image plugin or any other source:

    /**
     * Allows developers to change the OpenGraph image within theme.
     *
     * The dynamic part of the hook name. $network, is the network slug. Can be facebook or twitter.
     *
     * @param string $attachment_url The image we are about to add.
     */
    add_filter( "rank_math/opengraph/{$network}/image", function( $attachment_url ) {
    	return $attachment_url;
    });
    

    I hope this info helps. Thank you.

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

The ticket ‘Set Image for social media from custom url instead of media library’ is closed to new replies.