Support » Plugin: Yoast SEO » Can’t add post version with query string

  • Resolved Jaro

    (@pixtweaks)


    Hello,
    we have a different version of posts and it depends on query string. I’m trying to add these pages to sitemap but so far I got nowhere. I’m trying to use hook wpseo_sitemap_post_content
    Here is my code:

    function filter_wpseo_sitemap_type_content( $var ) { 
      $var = array (
      "loc"=>"http://test.local/uncategorized/QWE/?abc",
      "mod"=>"2020-09-19 10:55:54",
      "chf"=>"daily",
      "pri"=>1,
      "images"=>''
    );
    
        return $var; 
    }; 
             
    add_filter( "wpseo_sitemap_post_content", 'filter_wpseo_sitemap_type_content', 10, 1 );

    I have tried to return just a plain text and nothing showed up on the sitemap. What shall I do? Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Md Mazedul Islam Khan

    (@mazedulislamkhan)

    To add URLs manually to the sitemap index, you can find the guide here helpful which shows how to inject an external sitemap to the sitemap index.

    Thread Starter Jaro

    (@pixtweaks)

    Hi Md Mazedul,
    I was looking for adding entries to an already existing sitemap page. The solution you offered is somehow good but add complexity. It looks like wpseo_sitemap_post_content hook should do the job only I have something wrong. I couldn’t find on Google any workable solution. Any more suggestions?

    Thank you!

    Plugin Support Md Mazedul Islam Khan

    (@mazedulislamkhan)

    As much as we hate to say it, your question goes beyond the technical expertise of me and my colleagues on the Yoast support team. This means we can’t give you a solid answer to your question.

    But we don’t want to leave you empty-handed either, that’s why we’ve created our developer portal at developer.yoast.com. This has proven to be useful to many developers in the past, and hopefully will serve you well too.

    Sorry we can’t be of more help here.

    Thread Starter Jaro

    (@pixtweaks)

    Thank you anyway for looking!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can’t add post version with query string’ is closed to new replies.