Trailing slashes in sitemap – page

#5736
  • Resolved Alvin
    Rank Math free

    I have added the following code into the site and it works on post but not page. What should i do to fix that? Thanks

    add_filter( ‘rank_math/sitemap/entry’, function( $url, $type, $object ){
    $url[‘loc’] = untrailingslashit( $url[‘loc’] );
    return $url;
    }, 10, 3 );

    • This topic was modified 5 years, 7 months ago by Alvin.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    This is quite unexpected, please head over to Settings > Permalinks and click save. This should update the links on your sitemap.
    If the issue persists, please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    ​​​​​​​

    Hello,

    The code should remove trailing slash from all the URLs. Please purge cache by updating the permalinks and Sitemap Settings and check again. If that doesn’t help then please share your site’s admin access so we can check and fix this on your site.

    Thank you.

    Alvin
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hi Alvin,

    Thanks for the access.

    I cannot locate the code on your parent or child theme’s functions.php did you add it on a different location?
    I have added the code to your child theme and it should be able to work fine if you switch to the use of the child theme. I was unable to to make changes to the parent theme.

    I hope this info helps.

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

The ticket ‘Trailing slashes in sitemap – page’ is closed to new replies.