• Resolved emmanuelok

    (@emmanuelok)


    Hi, I need help with the right filter to enable priority and frequency to the sitemap.

    I tried the below snippets and they are not working.

    /**

    • Modify the sitemap entry to include changefreq and priority.
      *
    • @param array $url Array of URL parts.
    • @param string $type URL type (post, user, or term).
    • @param object $object Data object for the URL.
      */
      add_filter( ‘rank_math/sitemap/entry’, function( $url, $type, $object ) {
      if ( $type === ‘post’ ) {
      $url[‘changefreq’] = ‘weekly’; // Set your desired frequency
      $url[‘priority’] = ‘0.8’; // Set your desired priority
      } elseif ( $type === ‘page’ ) {
      $url[‘changefreq’] = ‘monthly’;
      $url[‘priority’] = ‘0.6’;
      } // Add more conditions for other types if needed
      // if ( $type === ‘custom_post_type’ ) {
      // $url[‘changefreq’] = ‘daily’;
      // $url[‘priority’] = ‘0.9’;
      // } return $url;
      }, 10, 3 );

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @emmanuelok,
     
    Thank you for contacting Rank Math support.
     
    You can’t change the priority or update frequency of the sitemap. There is no filter for that. The sitemap is generated dynamically and updated every time you publish or update a post. The sitemap needs to be updated to improve the crawling frequency of your site.
     
    If your sitemap is not being updated, then it might be cached. You can follow this guide to exclude it from cache: https://rankmath.com/kb/exclude-sitemaps-from-caching/
     
    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thread Starter emmanuelok

    (@emmanuelok)

    @rankmathsupport

    I am talking about adding the Priority and Frequency Tag.

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @emmanuelok,
     
    We currently don’t have a filter to modify the mentioned tags for our sitemaps.
     
    Don’t hesitate to get in touch with us if you have any other questions.

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

The topic ‘Priority and Frequency’ is closed to new replies.