Home › Forums › Backend Issues (wp-admin) › Duplicate CPT error when modifying slug name
Hi there,
I created a new CPT, configured it, got the front-end template working fine. Then my customer wanted to change the name of the CPT which I thought would be easy enough, but sadly it has not broken the CPT and there are 2 now visible.
So the old slug was called services. The new one is called treatments and there are 2 appearing in the front-end menu. So how do I reduce this to 1 and how do I get the single.treatments.php template to show it?
Thanks…
PS, I have activated a child theme and put the template file there also.
Right, I have managed to delete the old CPT and get the new one working. However, the old CPT is still appearing as a ghost in the menu and it has a typo which may be the original cause of the problem. I have tried removing it with a flush of the rewrite rules table, but that did not work.
I have attached the references from phpmyadmin below. Any idea what to do without knackering the DB?
s:37:"treaments/
[^/]+/attachment/([^/]+)/?$";s:32:"index.php?attachment=$matches[1]";s:47:"treaments/[^/]+/attachment/([^/]+)/trackback/?$";s:37:"index.php?attachment=$matches[1]&tb=1";s:67:"treaments/[^/]+/attachment/
([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$";s:49:"index.php?attachment=$matches[1]&feed=$matches[2]";s:62:"treaments/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$";s:49:"index.php?attachment=$matches
[1]&feed=$matches[2]";s:62:"treaments/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$";s:50:"index.php?attachment=$matches[1]&cpage=$matches[2]";s:43:"treaments/[^/]+/attachment/([^/]+)/embed/?
$";s:43:"index.php?attachment=$matches[1]&embed=true";s:26:"treaments/([^/]+)/embed/?$";s:42:"index.php?treaments=$matches[1]&embed=true";s:30:"treaments/([^/]+)/trackback/?$";s:36:"index.php?treaments=
$matches[1]&tb=1";s:38:"treaments/([^/]+)/page/?([0-9]{1,})/?$";s:49:"index.php?treaments=$matches[1]&paged=$matches[2]";s:45:"treaments/([^/]+)/comment-page-([0-9]{1,})/?$";s:49:"index.php?treaments=
$matches[1]&cpage=$matches[2]";s:34:"treaments/([^/]+)(?:/([0-9]+))?/?$";s:48:"index.php?treaments=$matches[1]&page=$matches[2]";s:26:"treaments/[^/]+/([^/]+)/?$";s:32:"index.php?attachment=$matches
[1]";s:36:"treaments/[^/]+/([^/]+)/trackback/?$";s:37:"index.php?attachment=$matches[1]&tb=1";s:56:"treaments/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$";s:49:"index.php?attachment=$matches[1]&feed=
$matches[2]";s:51:"treaments/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$";s:49:"index.php?attachment=$matches[1]&feed=$matches[2]";s:51:"treaments/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$";s:50:"index.php?
attachment=$matches[1]&cpage=$matches[2]";s:32:"treaments/[^/]+/([^/]+)/embed/?$";
This is really general WP. The problem is that when you remove a CPT that it does not delete the posts associated with it. Before renaming or removing a CPT you need to first delete all the posts that are associated with it if you want to remove them from the database. This is really the only way to delete them and all of their associated data, custom fields, revision, and whatever else WP stores about them.
The topic ‘Duplicate CPT error when modifying slug name’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.