Skip Navigation

[Resolved] Layout in Auto Draft can’t be deleted. Prevents Content Template from loading

This thread is resolved. Here is a description of the problem and solution.

Problem:

Have all posts to have the same format. Because of a lingering Layout Auto Draft that can't be deleted, new posts can have the Content Template Metabox while those created prior are prevented from using that same format as well as not displaying that Metabox.

Should I manually go into the database via phpMyAdmin, find and delete that layout? If so, please let me know where it's located. Although there is nothing tied to it that is clearly visible, might there be a record somewhere in the database that is preventing it from being sent to trash?

Solution:

Yes, you can remove that Auto Draft record from the database, but I suggest you backup your database first

The layouts data are stored in your database table wp_posts, layout ID is same as post ID.

Relevant Documentation:

This support ticket is created 6 years, 2 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 13 replies, has 2 voices.

Last updated by Luo Yang 6 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1134090

I am trying to:
Have all posts to have the same format. Because of a lingering Layout Auto Draft that can't be deleted, new posts can have the Content Template Metabox while those created prior are prevented from using that same format as well as not displaying that Metabox.

Should I manually go into the database via phpMyAdmin, find and delete that layout? If so, please let me know where it's located. Although there is nothing tied to it that is clearly visible, might there be a record somewhere in the database that is preventing it from being sent to trash?

Link to a page where the issue can be seen:

I expected to see:
The Content Template Metabox for the older posts that were created before the Layouts Auto Draft issue.

Instead, I got:

In a nutshell, by not being able to send that Layouts Auto Draft to Trash (it has a strikethrough and says 'This layout is tied to a post. It can't be deleted'), the issue then becomes the same as in this thread:
https://toolset.com/forums/topic/form-for-choosing-content-template-disappears/

...AND when I click the Content Template link in the Toolset menu of an 'older' post, the Layouts page loads. There are no checkboxes checked in the tab 'Templates for single posts or pages' nor the other tabs on the Layouts page.

Thank you.

#1134099

Hello,

Yes, it is expected result: if a layout is connected with some posts/pages, you can not move this layout into trash.

I suggest you remove the connection by this:
Edit the problem layout (Layouts Auto Draft), click button "Change how this layout is used", in the following dialog window, click button "Remove from list", and remove all connections, then you should be able to move this layout into trash.

#1134103

Thanks Luo for your reply.

I had done that as well previously, whereby it is blank - it shows no CPT association. Even the checkboxes within 'Change how this layout is used' are unchecked.

I even went as far as deleting the View as I think I essentially exhausted options other than the phpMyAdmin option.

Any other suggestions?

Thanks.

#1134104

This is abnormal, please try this:

1) In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2017, and test again

2) If the problem still persists, please provide database dump file(ZIP file) of your website, also point out the problem layout URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#1134107

Again, thanks for your reply.

In lieu of that trial and error process that will take quite a bit of time of which I really don't have, can I remove that Auto Draft record from the database? If so, where would it be?

Thanks.

#1134131

Yes, you can remove that Auto Draft record from the database, but I suggest you backup your database first.
https://toolset.com/forums/topic/layout-in-auto-draft-cant-be-deleted-prevents-content-template-from-loading/#post-1134107

The layouts data are stored in your database table wp_posts, layout ID is same as post ID

But as I mentioned above, there isn't same problem in my localhost with a fresh wordpress installation, if you need more assistance for it, please try as I mentioned above:
https://toolset.com/forums/topic/layout-in-auto-draft-cant-be-deleted-prevents-content-template-from-loading/#post-1134104

#1134137

I will try via the database first and hope that solves the issue. I will update this ticket as soon as possible when done.

Thank you again, Luo.

#1134812

OK, please update this thread if you still need more assistance, and the database dump file is ready to download.

#1139532

Hello again, Luo.

Today was the first opportunity to get back to this issue.

UPDATE: After being away from my website for a week, the Auto-Draft save of the Layout in question is no longer listed therefore, I didn't have to modify the database, thank goodness.

Q: Is there a cron job that deleted it? If so, where can I run it manually if that happens again?

Thanks.

#1139895

Unfortunately, there isn't such kind of cron job to remove Auto-Draft layouts, you might consider custom codes, for example:
https://codex.wordpress.org/Function_Reference/wp_schedule_event

And such kind of custom codes is out the range of Toolset support, you can check it with our Toolset Contractors.https://toolset.com/contractors/

#1142911

Thanks again for your reply, Luo.

To clarify, I am not looking to setup cron jobs. I was remarking that the Auto-Draft of the Layout that was causing the problem eventually went away. I noticed that when I came back to that website account a week later. Because of that, I did not have to manually delete that record from the database directly.

Therefore, my question was trying to find out 'how?' That's when I had asked, if there a cron job in the WP or Toolset software to 'cleanup' those Auto-Drafts?

Since you said that cron jobs aren't used for that cleanup, my new question is, what mechanism is being used and how long must we wait for that cleanup (deletion) so that it doesn't interfere like it did? Can we force that deletion without going to the database when it takes too long to delete itself?

Thanks.

#1142921

Thanks for the clarification, but the problem is how and where does those Auto-Draft of the Layout come from?

I have tried the latest version of Layouts plugin in a fresh wordpress installation, but there isn't similar problem?
Can you describe detail steps to duplicate the same problem?

If you are using other plugin/custom codes to create the Layout Auto-Draft, you will need to find it, and stop it from creating the those Auto-Draft.

#1144211

Thanks Luo.

I don't know about the mechanism that created and later deleted the Auto-Draft. I wished I did and also how to force it to go away like it eventually did.

I will move on from this issue. Hopefully, it will not occur again, although others have previously seen the issue as well.

Thanks.

Feel free to close this ticket.

#1144549

As your request, close this ticket