Skip Navigation

[Gelöst] Scan for where Content Template is used

This support ticket is created vor 1 Jahr, 8 Monate. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 9 Antworten, has 2 Stimmen.

Last updated by henrikG vor 1 Jahr, 7 Monate.

Assigned support staff: Christian Cox.


Hello Support.

After years of redoing stuff, I have lots of Views and Content templates.

I am cleaning my site, removing everything not used and refactoring post types etc into regular posts.

But when I try to delete a content template, I get a warning saying, "This conten template is used on 7 items" and the option to use a different content template.

It is not assigned to any types etc, but it may be used in a view somewhere.

There are no scan for content templates, only views.

Is there a trick to figure out where a content template is used?



There's nothing in wp-admin that will help find where the template is used, but you could try querying the database. If the template is assigned to any posts, you will find that template ID in the postmeta table under they key '_views_template'. That's where I would start. It may be assigned to posts in the trash, or somewhere else that isn't obvious. Let me know if this doesn't help track down the template assignments.


Well I am not that lucky.

Here is a screenshot of the content template ID and name in the wp-admin

hidden link

And when I try to delete this I get this popup where I am told that it is used in 7 items

hidden link

And If I query the post meta table in the database for the _views_template key I find no record to the 1065 post.
When I query all records to that particular post I get these records in return

hidden link

Are you sure its the post meta table I have to query?



Are you sure its the post meta table I have to query?
Yes but it seems I was not clear enough with my explanation. Instead of querying this table by meta_key = _views_template and post_id = 1065, try querying for meta_key=_views_template and meta_value = 1065. A meta_value of 1065 indicates the Content Template with ID 1065 is assigned to a post with ID = [post_id]. Once you identify those posts by ID, you can edit each one individually in wp-admin to unassign the Content Template 1065, or assign a different one.


Hi Support.

Yes et was a custom post type that I had created and deleted. However expected that, deleting a custom post type created in toolset would also delete the posts related to the post type?

Anyways I installed a plugin from the WordPress repository that could find posts with custom post types that was deleted, and this fixed my issue.

But is it really possible that you can delete a custom post type in Types, without deleting the posts with that type? It may be a bug that has been fixed, since I deleted the post type?



But is it really possible that you can delete a custom post type in Types, without deleting the posts with that type? It may be a bug that has been fixed, since I deleted the post type?
Actually the Types software is not designed to delete all the posts when you delete a custom post type. The posts will remain in the database unless you delete each post individually. I suggest deleting the individual posts before deleting the post type if you'd like to remove the individual posts from the database. If you have already deleted the custom post type in Toolset > Post Types, you could recreate the post type temporarily using the same slug. Then you would be able to delete the individual posts from wp-admin. After deleting the posts, you could again delete the post type again in Toolset > Post Types.


Ok Thanks Christian.

I still think its a mistake not at least to tell the user that there will be remaining posts in the database. I know its a common plugin way of thinking that you delete the plugin but not the settings.

I think this is the wrong way to treat the deletion, and the user should get the option of keeping the data or deleting it.

A minor tip for other users that face this issue.

Install the plugin : Custom Post Type Cleanup

It will find the left over posts and give you the option to re-register the post type for 10 minutes so you can delete the post types, or it will delete the posts for you.

Still I think it would be better to ask the user if types should remove the posts from the database to keep it clean. 🙂



Understood, I will present your argument to our team and see if a change in the software by feature request is warranted. I'll let you know what I find out.


Our second tier team has created a feature request to allow Users the opportunity to delete all posts in a custom post type when deleting the post type. I'll let you know by updating the ticket here if our developers are able to include this feature in an upcoming release in the near future. Thanks for your input!


Thank you.

This feature request will improve toolset, so thank you.