• Resolved small_fork

    (@emilymoran84)


    Hello,

    I have read through some posts in here about deleting CPTs and I understand that deleting the CPT does NOT remove any posts made within that CPT. So I do know to delete those before deleting the CPT itself from within the plugin.

    However, I found that even after deleting the CPT, which had no posts within it, the data for it is still in my wp_options “rewrite_rules” table. I’m unsure if this means too that there are other things “left behind” from the CPT.

    I’m wanting to also delete some custom taxonomies I created with the plugin, but want to be sure with removals of the taxonomies and CPTs that they don’t remain in places like the wp_options “rewrite_rules” table, which autoloads on every page.

    Is there any way for me to safely remove all traces of CPTs and custom taxonomies created with this plugin? (Outside of the content itself, as I understand I need to delete that prior to removing the CPT itself).

    I hope this makes sense and that I haven’t missed this in the documentation/FAQ.

    Thank you so much for your time!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi @emilymoran84

    We actually do try to flush the rewrite rules ourselves, most specifically about 5 minutes after any content type is created, updated, deleted, or imported.

    It is a soft flush which means it should be updating the rewrite_rules option, as per the developer.wordpress.org note about the flush_rewrite_rules() function:

    Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush).

    .

    Alternatively, if you need to have things flushed and rebuilt right away, visiting the Permalinks settings page should be handling that as well.

    Thread Starter small_fork

    (@emilymoran84)

    Hi @tw2113

    Thank you for the prompt reply. I tried visiting the permalinks page, but still am seeing the deleted CPT in the rewrite_rules.

    This is on a staging site that currently has a server-level password on it. Could that cause any permission issues that would prevent the plugin from properly flushing?

    I was wanting to test the CPT deletion before carrying it out on my live site.

    Thank you again!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    doubtful on the permission issue part, since this would all be happening on the server side and standard WordPress functionality.

    Since you’re saying it’s not clearing out just by visiting the permalinks page, lets try visiting and then saving without editing anything. Just go right to the save settings button and click, to see if that helps.

    If they’re still not clearing out then, even when you know you have zero of the deleted post types/taxonomies registered with CPTUI, then something is definitely amiss that I’m not sure of, or potentially the permalinks in general aren’t refreshing like they should, which would be an issue outside of just our plugin.

    Thread Starter small_fork

    (@emilymoran84)

    @tw2113 I tried as you instructed. I even turned off the server password, and then re-saved the Permalinks. I still see related things in the rewrite_rules but think I may have a better idea of what’s going on.

    The CPT had custom taxonomies also assigned to it, so I think maybe I’m seeing THOSE in the rewrite_rules.

    Should I try to FIRST delete the associated custom taxonomies, and then the CPT?

    Also, when deleting custom taxonomies made with the plugin, do I need to first delete all the terms within the taxonomy?

    Thank you again!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Can’t say I’ve ever known the order to matter with this topic, to be honest. If you’re planning to keep the taxonomies+terms afterwards, probably best to keep the terms. If you’re intending to get rid of the taxonomies as well anyway, then if you’re wanting a clean database, best to clean them out.

    In the event that you are also checking this via something like PHPMyAdmin or some other database tool, I’m curious how the results would be if you just outright deleted that rewrite_rules row in the options table and let it be rebuilt from scratch.

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

The topic ‘Deleting CPTs – How to “clean” everything (rewrite rules included)’ is closed to new replies.