Image Sitemap CDN

#641806
  • Resolved Sheree Baxter
    Rank Math free

    Hi, I use cloudflare as a CDN. I see I should use
    /**
    * Filter to Add CDN Image URLs in the Sitemap
    *
    * @param string $src Image URL.
    * @param object $post Post object.
    */
    add_filter( ‘rank_math/sitemap/xml_img_src’, function( $src, $post ){
    $src = str_replace( ‘http://domain.com’, ‘https://cdn.domain.com’, $src );
    return $src;
    }, 10, 2);

    Do I need to change anything in the above? Or do I just put into function.php? thanks

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math support and we apologize for the inconvenience.

    Use this exact code instead:

    /**
     * Filter to Add CDN Image URLs in the Sitemap
     *
     * @param string $src  Image URL.
     * @param object $post Post object.
     */
    add_filter( 'rank_math/sitemap/xml_img_src', function( $src, $post ){
    	$src = str_replace( 'http://domain.com', 'https://cdn.domain.com', $src );
    	return $src;
    }, 10, 2);

    Change the first http://domain.com to your website URL and https://cdn.domain.com to your CDN URL

    We hope this helps you resolve the issue. If you have any other questions or concerns regarding Rank Math, please feel free to contact us again. We are always happy to help.

    Thank you for choosing Rank Math!

    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.

Viewing 1 replies (of 1 total)

The ticket ‘Image Sitemap CDN’ is closed to new replies.