Restore wordpress theme custom css from duplicator database backup - css

I accidentally overwrote my sites custom CSS found in the theme options.
After some research I found out that the custom CSS is stored in the database.
I have a backup of the database from the duplicator plugin, however the backed up code looks different from the one found in phpmyadmin.
Current database from phpMyAdmin:
a:204:{s:8:"last_tab";s:2:"33";s:15:"body-background";a:7:{s:16:"background-color";s:0:"";s:17:"background-repeat";s:0:"";
Duplicator plugin backup database:
a:204:{s:8:\"last_tab\";s:1:\"5\";s:15:\"body-background\";a:7:{s:16:\"background-color\";s:0:\"\";s:17:\"background-repeat\";s:0:\"\";
As you can see there are backslashes on the backup code.
Any ideas of how I might be able to restore just the custom CSS from the options in the backup database?

Since you have you local site you can:
create a new db locally with your db backup
Update wp-config for your site to point to this new db temporarily
login to wp-admin and get Appearance/Customise css code, then
Copy this css back to your live site
I recommend then exporting your live db back to local so the change is applied and you have the latest version to work with
Of course you could do a SQL command to replace the record but this seems like too much work for this.

Related

Need help to live WordPress website without database

I have downloaded all files & folders from c-panel root directory but somehow I have deleted/lost the database from my end. So is there any way to get all content from my backup or am I able to live back my website without the database as well?
No, It is not possible to run WordPress without the database.
What's more:
The only database supported by WordPress is MySQL version 5.0.15 or greater, or any version of MariaDB.
Why it is not possible?
Because as You can read in WordPress Documentation, It is using the database
for storing and retrieving the content of your blog, such as posts, comments, and so on.
https://codex.wordpress.org/Database_Description
Basing on that you downloaded files I think You will be able to restore only parts of your website on new installation.

How do I keep WP db content synchronized in the filesystem?

I'm looking for an easy way to sync content that is in the Wordpress DB with the file system. Pages and Posts mostly, but any additional content would be great. I'm not looking to cover 100% of the DB content, just the most used configurations.
This is the Wordpress workflow I'm looking for:
Create a file in the filesystem, ie. /repo/posts/mypost.yml
Run a Wordpress command-line, ie. wp sync, which checks for sync status between my filesystem /repo/ and the content in the database.
Differing content from the db is exported and from the filesystem imported.
In case of conflict (double changes in both), ask for merge or whatever.
This is very common with the newer, file-based, CMSs, like Grav, Kirby, Jekyll, etc. but unfortunately, for many reasons, we're stuck with Wordpress.
That way we can use git and edit and version content in a much more robust way.
WordPress already has built-in version control in the database, called revisions. If you use different user accounts, WordPress will even lock pages that are being edited, preventing collisions.
Additionally, you can export the database to an .sql file and store it in your custom theme directory which you should manage with git. You only need to version control your custom theme directory, because all non-custom WordPress files already have version control. However, you can export the database every now and then to keep your git repository complete. Additionally you should ask your hosting provider to create daily backups.
This will give you full version control on everything (git for the theme and WordPress for the content). Developers will be able to take the git repository and rebuild the installation locally, to change the theme. Content can be edited remote in WP, with WP versioning and daily back-ups for security reasons.
Note that exporting your database to an sql file can be done by using a database manager like PHPmyAdmin or Adminer and using the export functionality or by using a WordPress plugin.

Migration issue in WordPress

When Migrate website development server to live server, Widget missed theme options missed and some configuration missed. We followed below steps,
Take backup of development server both files and database.
Moved files to live server and import database to live database.
updated configuration details in wp-config.php
Anyone had this issue?
You have done everything fine
but when we using options passed theme it is necessary to make changes again when you will move to live server.
Drag you widget again into the same format as it is on the local site. Select themes options again as you selected in the local server these are theme settings issue which is not stored in your database.
So you need to make changes again on your live server.One more thing make sure you theme URL should be changed into wp_options table
For URL change export your database open it into notpade++ editor and then find and replace your all URL from local to live site URL.
Then reimport it into your live site database with the help that you will no need to change URL from a wp_options table and also it will pick up the URL for your images and pages too.
Into the last step reset your permalinks first plains and then post name.
Thanks

How to move Wordpress to another domain without the chance to make a proper backup first?

So my webhoster closed down, where I hosted my Wordpress blog. I was able to receive a zip file containing all my data. I now have a new webhoster and I extracted the zip file to its root directory.
Trying to open my website now gives me "Error establishing database connection". The web tells me it may be related to hardcoded urls in the Wordpress database, which I need to replace by the new url.
However the tutorials usually tell you to use the Wordpress interface to create a backup of my database first, which can then be edited in tools like phpmyadmin. I can not access the Wordpress interface anymore and so far did not manage to edit the database otherwise.
I tried placing a local copy of the blog in the "C:\xampp\htdocs" folder, hoping phpmyadmin would recognize the database and allow me to edit it. Not working, maybe I am doing something wrong?
Any ideas to revive my Wordpress blog?
Cheers
Okay I think I got it working. For people having the same issue:
I loaded the database locally by copying the *.myd, *.myi, *.frm files to a new folder in my local xampp installation (e.g. C:\xampp\mysql\data\myDatabase).
I then used phpmyadmin to export this database to a .sql file.
On my webserver I then installed a fresh wordpress blog. It might be enough to copy your existing wordpress stuff, without needing to do this step afterwards, not sure.
My webhost has phpmyadmin preinstalled, so I used that to delete the fresh wordpress databases and import the .sql file instead. Now everything is in place, but since I changed my domain I need to change the URL paths in the database.
I used this script (use it by placing it on your webserver in the wordpress root folder and calling it in the browser) to do a search&replace of my old url to the new url: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
After that I only had to manually fix the path to my header image that I had edited in the past in the theme's header.php file.
Phew. Thanks for your help f00644.

Install Wordpress Backup with New Fresh Database

I had a website made in wordpress. The database is now corrupt, cannot be restored and I dont have a copy of the database either. However I have a copy of the website folder contents that I made when I installed wordpress. I want to use the same copied files to reinstall the website with a new(fresh) database so that I dont have to go through the whole process of psd to wordpress conversion and all. Is there a way out possible?
Regards.
Delete (drop) all the the site's DB's tables through PhpMyAdmin or mysql CLI, then go to your site url and repeat the install process.
wp-cli has a nice builtin cli tool for doing this: wp db reset
Just wipe the database with the Reset Database Plugin

Resources