Title: CPT Permalink Prefix Issue
Last modified: February 9, 2021

---

# CPT Permalink Prefix Issue

 *  Resolved [rooobreyes](https://wordpress.org/support/users/rooobreyes/)
 * (@rooobreyes)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/)
 * Hello,
 * We have this weird issue, we removed the “/courses” prefix for the post type “
   courses” using the plugin but for some unknown reason there are times that the
   prefix is reverting back causing 404 errors on the site.
 * Current Settings:
    [https://www.dropbox.com/s/jkpf38hpv8zutcr/chrome_rslW5BCD9X.png?dl=0](https://www.dropbox.com/s/jkpf38hpv8zutcr/chrome_rslW5BCD9X.png?dl=0)
 * Issue:
    [⌊02.08.2021-22.08.50⌉](https://www.screencast.com/t/tDc2qdqD)
 * Ways to replicate the issue(?):
    Editing a course triggers the issue as seen 
   on several instances whenever the client updates the content.
 * Our temporary fix is to have the URLs regenerated again, but that doesn’t help
   and cannot really call a fix.
 * Awaiting your favorable reply and help.

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

 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14024299)
 * Hi [@rooobreyes](https://wordpress.org/support/users/rooobreyes/),
 * It looks like the posts with broken permalinks are for some reason recognized
   by my plugin as either excluded or disabled. Therefore, their custom permalinks(
   without the /course/ prefix) are removed and original permalink reverted.
 * Could you check if the issue persists if “**Automatically fix broken URIs**” 
   option is disabled in Permalink Manager settings?
 * Please accept my apology for the inconvenience!
 * Best regards,
    Maciej
 *  Thread Starter [rooobreyes](https://wordpress.org/support/users/rooobreyes/)
 * (@rooobreyes)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14024346)
 * Hi Maciej,
 * Thanks for the swift response, will try that out and get back to you as soon 
   as possible.
 * Regards,
    Rob Reyes
 *  Thread Starter [rooobreyes](https://wordpress.org/support/users/rooobreyes/)
 * (@rooobreyes)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14029351)
 * Hi Maciej,
 * As promised I’m back and the result was the issue still persist when updating
   a course and all URLs are reset again.
 * Regards,
    Rob Reyes
 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14029986)
 * Hi [@rooobreyes](https://wordpress.org/support/users/rooobreyes/),
 * It would be difficult to find out what exactly makes my plugin reset the courses
   permalinks. Do you possibly have any staging website, where I can debug this 
   problem?
 * The other idea would be to force my plugin to save the default permalink again
   whenever the single course is updated (then you would not need to manually “regenerate/
   reset” custom permalinks to apply the correct format):
    [https://pastebin.com/Jmnucupk](https://pastebin.com/Jmnucupk)
 * Best regards,
    Maciej
 *  Thread Starter [rooobreyes](https://wordpress.org/support/users/rooobreyes/)
 * (@rooobreyes)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14030285)
 * Hi [@mbis](https://wordpress.org/support/users/mbis/),
 * Thanks for the response, I’ll try the code you just sent and get back to you 
   again. If no luck with the issue, I’ll setup a staging site for you.
 * Regards,
    Rob
 *  Thread Starter [rooobreyes](https://wordpress.org/support/users/rooobreyes/)
 * (@rooobreyes)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14084948)
 * Hi [@mbis](https://wordpress.org/support/users/mbis/),
 * We have been monitoring the issue for a while now, but this time the URLs shifted
   back again even with no admin interactions are made.
 * The code that you provided last time is already on the function.php file of the
   theme but it seems that didn’t work as well.
 * We even checked if flush_rewrite() is causing the issue.
 * We already have a copy of the live site on staging for you to debug the issue,
   let me know if where I can send you the credentials.
 * Regards,
    Rob
 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14085009)
 * Hi [@rooobreyes](https://wordpress.org/support/users/rooobreyes/),
 * Please send the credentials to my email address:
    contact /at/ maciejbis.net
 * Best regards,
    Maciej
 *  Thread Starter [rooobreyes](https://wordpress.org/support/users/rooobreyes/)
 * (@rooobreyes)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14085079)
 * Hi [@mbis](https://wordpress.org/support/users/mbis/)
 * You should receive a reset password URL for username maciejbis, I also changed
   it to superadmin access.
 * Currently the site is on a multisite setup, the issue is only happening on the
   EN site which is a weird case.
 * Let me know if you need an SFTP access as well.
 * Regards,
    Rob
 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14085104)
 * Hi [@rooobreyes](https://wordpress.org/support/users/rooobreyes/),
 * Thank you for credentials. The first thing I noticed is that “Automatically fix
   broken URIs” mode is still turned on.
 * In past I had a few reports that my plugin can improperly mark custom post types
   items registered with CPT UI plugin as “invalid”.
 * Could you check if the “reverted” permalinks are still stored in the array with
   custom permalinks used by my plugin? You can check them in “Permalink Manager-
   > Debug” section.
 * Best regards,
    Maciej
 *  Thread Starter [rooobreyes](https://wordpress.org/support/users/rooobreyes/)
 * (@rooobreyes)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14085162)
 * Hi [@mbis](https://wordpress.org/support/users/mbis/)
 * The “Automatically fix broken URIs” is already turned off on the live site when
   that happened.
 * We had to quickly revert back the urls on live since the courses are the most
   visited pages on the site.
 * [https://www.dropbox.com/s/wfpi854006wkkpw/Lsvh9ekY9O.png?dl=0](https://www.dropbox.com/s/wfpi854006wkkpw/Lsvh9ekY9O.png?dl=0)
 * URL Array:
    [https://www.dropbox.com/s/ubqyj5sqg772edu/Mnda3e9zKl.png?dl=0](https://www.dropbox.com/s/ubqyj5sqg772edu/Mnda3e9zKl.png?dl=0)
 * I think we can check the debug tab again if the issue occurs on the live site
   again.
 * Regards,
    Rob
 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14085631)
 * Hi [@rooobreyes](https://wordpress.org/support/users/rooobreyes/),
 * Thank you! I would be grateful if you can check if the relevant custom permalinks
   are still stored in “Debug” tab after the issue appears again.
 * Best regards,
    Maciej
 *  Thread Starter [rooobreyes](https://wordpress.org/support/users/rooobreyes/)
 * (@rooobreyes)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14089880)
 * Hi [@mbis](https://wordpress.org/support/users/mbis/)
 * Is there a way we can restore the values from our staging site to the live site?
   All of the custom permalinks on one instance of our site is gone for some reason.
 * Regards,
    Rob
 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14089902)
 * Hi [@rooobreyes](https://wordpress.org/support/users/rooobreyes/),
 * the custom permalinks are stored in “wp_options” table with “permalink-manager-
   uris” key.
 * It would be difficult to debug this issue with your specific environment. Would
   you mind if I prepare you a tailored, alternative solution that would allow to
   remove CPT (course) prefix instead of my plugin?
 * Best regards,
    Maciej
 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14090279)
 * Hi again [@rooobreyes](https://wordpress.org/support/users/rooobreyes/),
 * I prepared the mini-plugin that would allow you to dynamically remove /courses/
   CPT base. You can find all the code in _wp-content/plugins/bis/bis.php_ file 
   on your staging website.
 * Best regards,
    Maciej
 *  Thread Starter [rooobreyes](https://wordpress.org/support/users/rooobreyes/)
 * (@rooobreyes)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14100005)
 * Hi [@mbis](https://wordpress.org/support/users/mbis/)
 * Thanks for the fix, we’ll have it deployed on live site as well and monitor if
   that fixes the issue.
 * Will get back to you again.
 * Regards,
    Rob

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

The topic ‘CPT Permalink Prefix Issue’ is closed to new replies.

 * ![](https://ps.w.org/permalink-manager/assets/icon.svg?rev=2625166)
 * [Permalink Manager Lite](https://wordpress.org/plugins/permalink-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/permalink-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/permalink-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/permalink-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/permalink-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/permalink-manager/reviews/)

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [manager](https://wordpress.org/support/topic-tag/manager/)
 * [permalink](https://wordpress.org/support/topic-tag/permalink/)
 * [post-type](https://wordpress.org/support/topic-tag/post-type/)

 * 15 replies
 * 2 participants
 * Last reply from: [rooobreyes](https://wordpress.org/support/users/rooobreyes/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/cpt-permalink-prefix-issue/#post-14100005)
 * Status: resolved