Deleting a Page Type...it won't go!
Permalink 1 user found helpful
I've defined my own page types and in order to tidy up this specific site I want to remove the OOTB ones (Right Sidebar). I go into the Page Types admin, click 'Settings' on this PageType that I want to remove, click 'Delete', I accept the confirmation and the page refreshes but the Page Type is still there!!
I have checked the Design options for every page in the site (other than Dashboard) and this Page Type isn't assigned to any of them.
Is there anywhere in the DB that I can query to see why this Page Type is locked?
I have checked the Design options for every page in the site (other than Dashboard) and this Page Type isn't assigned to any of them.
Is there anywhere in the DB that I can query to see why this Page Type is locked?
Thanks for your reply - its my own custom theme, developed entirely from scratch, I don't even have a corresponding .php file for this Page Type...actually, I wonder if this would be solved if I create one, then try to delete the Page Type, then delete the temporary .php - I'll give it a try!
Nope, that didn't work ;o( So whats stopping me from deleting this Page Type?
Your old page versions probably still use the page type. This is just an issue in that page's controller which doesn't show the error properly but redirects you back to the page types index.
What you can do is to go to Dashboard > System & Settings > Optimization > Automated Jobs and run the "Delete old page versions" task. If you still cannot delete the page type, you can check the code from that job's controller and just delete all the OLD page version (BE VERY CAREFUL NOT TO DELETE THE CURRENTLY ACTIVE VERSIONS).
Naturally, you can find the job's code from the job's controller:
That code limits the deletion to 10 latest versions on line 53. You can also do that with a single straight SQL query but I guess it's safer to do it programmatically using the API methods. Also, that code should take care that you're not deleting the most recent or approved version of the page.
What you can do is to go to Dashboard > System & Settings > Optimization > Automated Jobs and run the "Delete old page versions" task. If you still cannot delete the page type, you can check the code from that job's controller and just delete all the OLD page version (BE VERY CAREFUL NOT TO DELETE THE CURRENTLY ACTIVE VERSIONS).
Naturally, you can find the job's code from the job's controller:
/concrete/core/jobs/remove_old_page_versions.php
That code limits the deletion to 10 latest versions on line 53. You can also do that with a single straight SQL query but I guess it's safer to do it programmatically using the API methods. Also, that code should take care that you're not deleting the most recent or approved version of the page.
Hi Mainio, thanks for this tip, I hadn't considered old versions.
I tried amending the value in the job controller to '1' instead of '10', then ran the job, but still the Page Type will not delete.
Is there a SQL query that I can run to see which page version is still using this Page Type?
p.s. I actually think that this is a bug - when deleting a Page Type, a warning should show giving you the option to also delete any old versions which utilise the Page Type, or the warning should state that the Page Type is still in use by ..... pages.
I tried amending the value in the job controller to '1' instead of '10', then ran the job, but still the Page Type will not delete.
Is there a SQL query that I can run to see which page version is still using this Page Type?
p.s. I actually think that this is a bug - when deleting a Page Type, a warning should show giving you the option to also delete any old versions which utilise the Page Type, or the warning should state that the Page Type is still in use by ..... pages.
Thanks, I was having the same problem and I managed to fix it and delete the page version.
I found a few things:
- As said, I had to empty the trash
- checked that no existing pages were using that page type
- Note- I had to run the cron for delete versions A FEW TIMES
- As well as the trash pages in the sitemap, there were some drafts hiding from me which were using this page type. When you look at the sitemap with show system pages turned on, look for a "drafts" heading... (then you'll have to empty the trash again..!)
I found a few things:
- As said, I had to empty the trash
- checked that no existing pages were using that page type
- Note- I had to run the cron for delete versions A FEW TIMES
- As well as the trash pages in the sitemap, there were some drafts hiding from me which were using this page type. When you look at the sitemap with show system pages turned on, look for a "drafts" heading... (then you'll have to empty the trash again..!)
To find pages that are using a particular page type,
Use the Page Search under Sitemap in the Dashboard,
To do this, leave the "Page Name" box empty, Select the "Page Type" and click "Search",
You will be presented with a list of pages that are using the page type.
Use the Page Search under Sitemap in the Dashboard,
To do this, leave the "Page Name" box empty, Select the "Page Type" and click "Search",
You will be presented with a list of pages that are using the page type.
Thanks for this, perfect! Lets hope that future versions of C5 allow you to lookup pages associated with a Page Type.
Whilst you could edit or override the theme to delete the associated right sidebar php file, I wouldn't recommend doing so.