Where in database is the css located?

I’m having a major problem in X-Pro. From time to time when I save the CSS in my Home Page Custom CSS I get an error message that the changes cannot be saved and it deletes all of the CSS. I just lost hundreds of lines of CSS. This CSS must be somewhere in the database, no?

Hi @mcaravaglia,

Thanks for writing to us.

Regretfully, if the CSS is not in the Theme Options > CSS that means it is not in the database.
I would suggest you take the backup of your site from time to time to avoid this situation.

Thanks

Thank you for responding. I’m concerned there may be a bug in the latest version of Pro. I’m not sure what other explanation there could be to cause hundreds of lines of CSS to simply disappear from the Home page Custom CSS field.

After making one simple edit, the change could not be saved. So, i refreshed the browser thinking id lose just that change. Not the case, it wiped out the entire CSS field. Something ain’t right.

Hi @mcaravaglia,

I recommend the following troubleshooting procedures before we investigate the settings.

  1. TESTING FOR THEME RELATED ISSUE
  2. TESTING FOR PLUGIN CONFLICT
  3. THEME UPDATE
  4. CHILD THEME
  5. CSS/JS CUSTOMIZATION
  6. VERSION COMPATIBILITY

Only if none of those help, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password

You can find the Secure Note button at the bottom of your posts.

Thank you.

I have (previously) gone through this same troubleshooting exercise. There are no issues with any of these things.

When I originally started this website, I had this exact issue with the Custom CSS field in the Home page. I kept getting an error message that it could not save the changes and it would delete all of the CSS. I finally saved my Home page as a template, created a new Home page and imported the template. I then re-entered all of the CSS and everything was fine for a couple of weeks. Today, my new Home page experienced the exact same issue and I lost all of the CSS.

There is definitely an issue with the Custom CSS field on the page designated as the Home page, OR, perhaps, any individual pages CSS field, as this has happened multiple times and does not happen to the code entered in the CSS field under the “Options” menu.

Moving forward, I will add a Stylesheet to the child theme and not use the individual page CSS field, as there is clearly an issue.

Hi @mcaravaglia,

Sorry to hear that you’re having this issue, I see you have multiple sites, does this issue happening to all of your site or just a specific one? And is this happening to all of the pages or just the homepage? You might have a 3rd party element or widget or custom script on your page that causing a conflict on the content builder.

It’s also possible that you might have a browser add-ons on your end that is causing the issue, perhaps your anti-virus/internet security. Please check these things as this is not a common issue with the theme, in fact this is the first time I hear about losing Page > CSS (besides those related to migration).

Thanks,

Thank you @friech. This is indeed the only site I have this issue with, but I also believe this is the only site running the latest version of X-Pro.

The only pages I have CSS on, is the Home Page, where I have entered page-specific CSS. Any CSS that is global across the site, like Headers and Footers, I have coded in the Custom CSS section under the “Options” menu. It is only the Home Page CSS that has this issue.

As for 3rd-party elements on the page, the only element is “Post Grid” which is one of your supported plugins.

I’m not sure how to go about “Checking” browser extensions, or my security software. This issue is extremely difficult to troubleshoot. When it happens, you simply get an error message that the change cannot be saved. Then, if you either close the CSS window, or refresh the browser, all of the CSS gets deleted. So, once it happens you’re pretty screwed and can’t go about testing plugins, etc.

While the forum posts below date back to older versions, there seems to be a great similarity between what I am experiencing and the users that posted these.



As a matter of curiosity, where does the page-level Custom CSS get stored. If it is not in the database, where does it reside? Is it (remotely) possible the code is still there, but not displaying in the Custom CSS window?

Hi @mcaravaglia,

The CSS codes are stored into the database for sure, but if you are not finding any CSS in Theme Option or Custom CSS that means the database does not contain that anymore.
So there is no chance to get back from the database, if you have any site backup in the past, you may find those there.

Please share your site credential as asked my colleague, to check what the issue is occuring while saving.

Thanks

I am able to get a folder containing a backup of the entire website from my hosting service. I want to go into these files and only retrieve the CSS that was contained in the Home Page CSS window. Are you able to guide me as to where I can find the CSS from only the Home Page?

Hey @mcaravaglia,

I’m sorry but you won’t find the CSS in the database because it’s not saved in the first place. If you encounter the “Uh Oh, failed to save content” error, you need to copy your CSS to a text editor because if you’re going to reload the page, it will get lost. It will not be saved in the database.

Now, I’m confused by your statement.

Question: How will the CSS window be emptied if it’s already empty?

I believe you’re writing CSS on it then you try to save the page? If this is the case then your CSS, like I’ve said above, is not yet saved. That means it’s not stored in the database. No content is saved including the CSS so if you reload the page, all your work will be gone.

Investigating the saving issue, I deactivated all 3rd party plugins, and the saving was fixed and I was able to add CSS to your “Home” Page.

image

I understand you tried the troubleshooting step but it looks like you didn’t follow the instruction completely or skipped some plugins.

To test this again, DEACTIVATE ALL 3rd party plugins then review the plugin conflict test here https://theme.co/docs/common-issues#testing-for-plugin-conflict

Thanks.

Understood, thank you. The reason you saw the CSS window was empty was because it all was lost.

I will test all of the plugins to find the issue. However, I am having the hosting service provide me with a copy of the entire website, including the database, prior to my losing all of the CSS. Can you please tell me, in what directory will I find the CSS that was previously entered into the Home Page CSS window? I would like to retrieve it.

Hey @mcaravaglia,

Do you mean your page titled “Home” has CSS before that was successfully saved and then when you clicked the Save button again the CSS was wiped out because of the “Uh Oh, failed to save content” error? Please remember what I said that if the CSS was NOT YET SAVED then you click the Save button and the builder failed to save, you will not find your CSS in the database.

Since you are inclined to look for the CSS in the database, search for _cornerstone_settings meta_key that contains your CSS in the wp_postmeta table of WordPress.

Please note that working with the database is beyond the scope of our theme support. We can only give you where the Content CSS is located. If you’re having trouble finding your CSS, please consult with a database expert.

If you can restore your site from the backup, that would also be an option.

Hope that helps and thank you for understanding.

Christian,
YES, there were 600 lines of CSS that were previously saved. I went in, made a single, minor edit, and tried to save the page. The error appeared and I could not save after multiple attempts. I then closed the CSS box, refreshed the browser and when I went back in, all the CSS code was gone!

I have since, tested all of the plugins and identified one that seems to be the problem. I disabled it earlier and was able to save the page. Now, I just have to try to retrieve just this CSS from the backup database.

@mcaravaglia,

We are glad that you are able to find the culprit plugin that causing your problem and we are hoping that you could retrieve your CSS from your backup.

Let us know how it goes.

Thank you.

I have restored all of the CSS, retrieved from the database, and all seemed fine. However, I am once again having an issue with the save error on this Home page. When I disabled the plugin I suspected, I was able to save the page, but after a while the error began again. I disabled another non-critical plugin and it began to work fine. Now, once again, I cannot save the page after a very minor edit.

I currently have deactivated eight of sixteen total plugins, leaving only the critical ones active and I still cannot save.

My guess is if I disabled all of the plugins I’d be able to save the page and after a time, even with all plugins disabled, the inability to save would likely return. I can’t really do this, however, as it is a live site and my client has quite a number of users viewing the site daily.

I would love to be able to re-install the X-Pro Theme, as I have never had this problem using this Theme on any other website. However, I fear reinstalling the Theme will create many problems, requiring me to rework the site.

Hey @mcaravaglia,

It is best that you clone your live site to a staging site. We can test your staging site if we can replicate the issue. We can then investigate further why this issue is happening in your setup. Kindly give us access to your staging site too.

To know how to create a staging area, please check out these articles:


Best Regards.

Staging site has been created. Same UN and PW as sent prior.

Hi @mcaravaglia,

Since you already have the staging site, please re-install the Pro theme and the Wordpress itself, you can reinstall WordPress under Dashboard > Updates and see the Re-install Now button, but please keep a backup first.

You can re-install Pro by switching to default WordPress theme first (you cant delete an active theme), then delete the current PRO on your site and install a new one.

Remember to clear all your caching features (plugin, server-side, CDN, and browser’s cache).

Then test your staging site if the issue happen in there.

Cheers!