Revisions or history

Hi, how can we see revisions or history from theme templates?

Hello @hollandsonline,

This is currently not possible.

Template revision will be available in WordPress 6.3 as it has been included in the Gutenberg plugin → What’s new in Gutenberg 15.2? (22 February) – Make WordPress Core


1 Like

How can we recreate this feauture right now?

I don’t think it can be recreated right now. Besides, it would be a waste of time if it’s due to come out natively at some point anyway. You could probably accomplish this right now by building your template in a normal page (saved as a draft), then copy/past the blocks to a template. Then use the draft page as kind of a staging area for the template… it’s not ideal and I’m not sure if there are use cases where this wouldn’t work, but it’s an idea to try for now. Alternatively, just don’t ever make any mistakes and you’ll never have to worry about revisions! :rofl:

1 Like

Hi all,

A quick tip to prevent heart attacks or bangings on the wall or insulting all gods of the universe for hours when accidentally losing templates…

If like me, you just overwrote some complex template and lost ten hours of work, just don’t panick and stop everything on the website.

You still can retrieve template content, since template revisions do actually exist in Wordpress (don’t know since when). They are just not available in the editor UI (yet).

DISCLAIMER: It’s a bit risky, so people who are not familiar with WP database and PHPMyAdmin shouldn’t try.

Template revisions are actually stored like any post revision.

  1. So you need to search in the posts table the post_type “revision” and look for your template title, select the right revision (the most recent revision is actually the newly saved, so perhaps the one you need if the one BEFORE the most recent), then COPY the whole post_content field:

  1. Then go back to the posts table and look for the post_type “wp_template”, find your template, and PASTE into post_content field:

Everything should be back in order now :slight_smile: