WordPress Jetpack Custom CSS — Where Is Its Data Stored?


One of the great bonuses that WordPress Jetpack adds to your site is the simplicity of CSS customization. Jetpack brings in its own awesome CSS stylesheet editor.

You simply go to your WordPress Dashboard > Appearance > Edit CSS and you can change anything you want. I have added more than 600 lines of CSS code thanks to WordPress Jetpack to customize the layout and behavior of my theme and plugins.

Your Custom CSS Can Be Reset

However, notice this one little warning at the top of the page:
Note: Custom CSS will be reset when changing themes.

WordPress Jetpack CSS Stylesheet Editor

WordPress Jetpack CSS Stylesheet Editor

This means that all your CSS customizations will be gone in two cases:

  • when you change your theme — upload and activate a new one instead of the old one
  • when you create and activate a child theme to your current theme

Restore Your WordPress Jetpack Custom CSS

Thankfully, your custom changes are not deleted.

There are actually two ways to restore your work on your CSS:

  1. Restore your custom CSS stylesheet from previous revisions.
  2. Restore your custom CSS from the SQL database.

Restore from Revision

WordPress saves all changes you make to your website, therefore no data is ever really lost.

Whenever you make changes to your posts, pages, or the CSS stylesheet editor and then click on the Update button, the previous version of that post, page, or CSS stylesheet gets saved as a revision.

So, when you change your theme and your CSS customizations get reset, all you need to do is locate the list of CSS Revisions at the WordPress Dashboard > Appearance > Edit CSS page.

List of CSS revisions

List of Jetpack CSS revisions

Then click on the most current revision located at the top of the list.

Compare Revisions of "Custom CSS Stylesheet"

Compare Revisions of “Custom CSS Stylesheet”

And, finally, click on the Restore This Revision button in the Compare Revisions of “Custom CSS Stylesheet” page.

Restore from Database

Another way to restore your Jetpack-created CSS stylesheet is directly from the database.

It is a bit harder to do it this way, nevertheless it might come in handy sometimes.

Related Post

How to Decrease the Size of Your WordPress Database by 80%

It’s possible to dramatically shrink the size of your WordPress database by removing post revisions.

For example, if you change themes and right after that you remove all the revisions from your WordPress blog, using a plugin such as Better Delete Revision.

Believe me, this occurrence is not that far-fetched…

In the above case, I hope that you back up your database regularly, because the CSS stylesheet has been totally wiped from your current database.

So, locate the most recent backup file of your WordPress SQL database.

If you use WP-DBManager or a similar solution to automatically create backups of your database on a regular basis, then all you need to do is go to WordPress Dashboard > Database > Manage Backup DB.

In there, select the most current backup of your database (which still includes your custom CSS stylesheet) and click Restore.

Restore database backup

Restore database backup

Important Note

Before restoring even the most recent backup of your database, make sure that you first create a new backup of your current database. This is just a safety measure, so that you don’t pile on the problems you already have.

In case you are comfortable digging around in your backup database files manually, you don’t need to restore a previous version of your database at all.

What you can do is open the database file in a useful text editor such as Notepad++. The file should end with a .sql suffix.

And in this file search for (Ctrl+F) the term safecss. It is located in the wp_posts table.

Simply select and copy out (Ctrl+C) the CSS code from there and paste it (Ctrl+V) into your current WordPress Dashboard > Appearance > Edit CSS page. Then click on the Update button.

And ta-da, just like that, you’ve got your custom CSS settings back.

Liked this post?

Subscribe to our newsletter to receive early notification of new posts and deals:
[mc4wp_form id=”45″]

Next Post »« Previous Post