• Resolved Dave

    (@tlwh)


    Hi

    I’ve read https://semperplugins.com/documentation/support-external-images-in-the-xml-sitemap/

    
    add_filter( 'aioseop_images_allowed_from_hosts', 'my_aioseop_images_allowed_from_hosts' );
    
    function my_aioseop_images_allowed_from_hosts( $hosts ) {
    $hosts[] = '*.wp.com';
    return $hosts;
    }

    My question is:
    What is the correct url if your images are hosted externally but the CNAME is a subdomain. eg my website is mysite.com
    My images are on photostock.com but they CNAME it to gallery.mysite.com
    So is this correct?
    $hosts[] = '*.mysite.com ';

    Or something else?

    • This topic was modified 5 years, 5 months ago by Dave.
    • This topic was modified 5 years, 5 months ago by Dave.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Steve M

    (@wpsmort)

    Yes, that should work. The * is a wildcard that will include images from any subdomain of mysite.com

    Thread Starter Dave

    (@tlwh)

    Thanks.

    I’ve implemented the function. Updated the sitemap. Cleared Cache etc.

    The site map still doesn’t show any extra images. Is that right? or should it be counting the external ones in the site map?

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    .

    • This reply was modified 5 years, 5 months ago by Michael Torbert. Reason: already responded to by Steve
    Plugin Support Steve M

    (@wpsmort)

    You should see it in the source code of the sitemap like this:
    `
    <image:image>
    <image:loc>https://subdomain.mysite.local/my-image.jpg</image:loc&gt;
    </image:image>
    `

    I’ve tested this here and confirmed it works.

    Thread Starter Dave

    (@tlwh)

    Hmmm.

    I’m only getting locally hosted images showing like that in the source, not external or subdomain ones.

    Any ideas on what could be stopping this from working?

    (Edit) Just tired it on another site and still not working for me. Could it be the CNAME issue?

    • This reply was modified 5 years, 5 months ago by Dave.
    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    Could it be the CNAME issue?

    Unlikely, but since you haven’t shared your website or the exact code you’re using there’s no way we could possibly know what the problem is.
    The filter definitely works, so if I had to guess I’d say there’s a bug in your callback function.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘External images on site map API confirmation’ is closed to new replies.