Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter becahp

    (@becahp)

    Hi @rilwis , thank you so much for your prompt and helpful response. With your directions, I was able to add a custom URL to SlimSEO sitemap successfully.

    I just want to share a couple of notes based on your instructions:

    Indeed we need to close the current <url> but we don’t need that last echo to close the new URL we’re adding. In the end, the code looks like this:

    add_filter('slim_seo_sitemap_post', 'output_test');
    function output_test() {
        echo "\t</url>\n";
        echo "\t<url>\n";
        echo "\t\t<loc>mywebsite.com/cientista/?item_id=1</loc>\n";
    }

    Lastly. for anyone else attempting to add custom URLs using the code provided, please keep in mind that it will add the URL to every post that the plugin’s crawler goes through when building the sitemap. To prevent this, I’ll be adding some conditions using the global $post variable in the function that the hook accepts. This way, we can make sure the URL is added just once.

Viewing 1 replies (of 1 total)