Sitemap permalink issue on a custom post type

#759942
  • Resolved Marco Lys Lisei
    Rank Math free

    Sorry to post it again, but I’ve missed your reply in my previous ticket that has been closed.

    Dear RankMath team,

    I’m having an issue with the URL generated on the sitemap for a custom post type i’ve created on a plugin i’ve vedeloped.

    The custom post type is for car listings.

    The permalink structure is as follow in this example:

    https://www.brunobet.it/auto/audi-a3-2-0-tdi-184-cv-sport-fari-led-quattro-s-tronic/179803/

    where 151222 is the ID to get the post and audi-a3-2-0-tdi-184-cv-sport-fari-led-quattro-s-tronic is the post title, but it may be a random word as the parameter used to get the post is the post id.

    in RankMath sitemap this URL appears like this:

    https://www.brunobet.it/auto/contact-form-1/179803/

    How can I manage to get that “contact-form-1” replaced by the post title?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    I apologize for the inconvenience you faced with the sitemap permalink for your custom post type. To address the issue of the incorrect URL structure in the Rank Math sitemap for your custom post type “car listings,” you can follow these steps:

    1. Check Permalink Settings: Ensure that the permalink settings in WordPress are correctly configured to display the post title in the URL structure. You can adjust this by going to Settings > Permalinks in your WordPress dashboard.

    2. Rank Math Settings: Verify the settings in Rank Math related to custom post types. You can navigate to Rank Math > Titles & Meta > Post Types and ensure that the correct variables are set to display the post title in the URL.

    3. Flush Permalinks: After making any changes, remember to flush the permalinks by going to Settings > Permalinks and clicking on the “Save Changes” button. This action will refresh the permalink structure.

    If the issue persists after following these steps, please reply to this ticket, and a human agent from our support team will assist you further.

    Thank you for bringing this concern to our attention. We appreciate your patience.

    Best regards.

    Sources:
    Rank Math Sitemap Issues and Their Fixes » Rank Math
    WordPress Permalink Structure & Changing Individual URLs » Rank Math
    Why Isn’t My URL Included in the Sitemap? » Rank Math
    How to Configure Sitemaps in Rank Math – Best Settings and Tips
    Analyzing Your Site’s SEO with Rank Math’s SEO Analysis Tool

    This is the rewrite rule i’ve applyed for the custom post type:

    add_rewrite_rule( ‘^’.$listings_page.’/([^/]*)/([^/]*)/?([^/]*)/?’, ‘index.php?pagename=’ . $listings_page . ‘&ac_listing=yes&id=$matches[2]&extra=$matches[3]’, ‘top’ );

    I’ve also tried with this one but again, it’s showing up a random page slug instead of the post slug:

    add_rewrite_rule( ‘^’.$listings_page.’/([^/]*)/?([^/]*)/?’, ‘index.php?pagename=’ . $listings_page . ‘&ac_listing=yes&name=$matches[1]&extra=$matches[2]’, ‘top’ );

    Thanks

    Hello,

    Thank you for your patience.

    We’ve checked your sitemap, and the URL appears as it is:

    sitemap

    Could you please confirm where are you seeing the link with the contact form in it?

    Looking forward to helping you.

    Hi,

    thanks for getting back on this.
    Yes, I confirm I’ve fixed the issue, it was related to this hook: add_filter( ‘post_type_link’), i was submitting the wrong parameter.

    Thanks

    Hello,

    Thank you for the update.

    We’re glad that you have already managed to resolve this issue.

    If you have any other concerns, please don’t hesitate to contact us anytime to assist you further.

    Looking forward to helping you.

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

The ticket ‘Sitemap permalink issue on a custom post type’ is closed to new replies.