Position in Sitemap

#730552
  • Resolved Ivan
    Rank Math free

    It is possible to change the sequence of output from the HTML Sitemap, so that the Categories are not the Post at first.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello, I apologize for the inconvenience. Yes, it is possible to change the sequence of output from the HTML Sitemap in Rank Math. You can do this by configuring the “Sort By” option in the HTML Sitemap settings. You can choose to sort the items in the HTML sitemap by Published Date, Modified Date, Alphabetical, or Post ID. Here’s a screenshot of the “Sort By” option in the HTML Sitemap settings:

    Sort By option

    You can access the HTML Sitemap settings by navigating to Rank Math SEO → Sitemap Settings in your WordPress dashboard. Once you’ve configured the “Sort By” option, don’t forget to click on the Save Changes button to save your settings.

    If you have any other questions or need further assistance, feel free to ask.

    Sources:
    How to Configure Sitemaps in Rank Math – Best Settings and Tips
    How to Create HTML Sitemap Using Rank Math » Rank Math

    Ivan
    Rank Math free

    we need sort by type https://prnt.sc/G-STogH1Isgu

    Hello,

    Thank you for contacting us and sorry for any inconvenience that this issue might have caused.

    You can use the following filter to change the order of the HTML sitemap:

    /**
     * Filter: 'rank_math/sitemap/html_sitemap/sort_items' - Allow changing the sort order of the HTML sitemap.
     *
     * @var array $sort {
     *    @type string $field The field to sort by.
     *    @type string $order The sort order.
     * }
     * @var string $type     The item type.
     * @var string $name     The post type/taxonomy name.
     */
    add_filter('rank_math/sitemap/html_sitemap/sort_items', function ($sort, $type, $name) {
        return $sort;
    }, 10, 3);

    If you’re not sure how to add this code, you can follow this guide: https://rankmath.com/kb/wordpress-hooks-actions-filters/.

    Let us know how this goes. Please let us know if you have further questions or concerns.

    Thank you.

    Ivan
    Rank Math free

    Hello,

    Can you please try to use the following filter on your website and see if that works for you?

    add_filter( 'rank_math/sitemap/html_sitemap_post_types', function( $post_types ) {
    	$post_types[0] = 'page';
    	$post_types[1] = 'post';
    
    	return $post_types;
    } );
    

    You’ll have to include the other post types in sequence.

    Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    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 5 replies - 1 through 5 (of 5 total)

The ticket ‘Position in Sitemap’ is closed to new replies.