Hello, carnifex08, & welcome. Yeah, this is *always* fun times when stuff like this happens (not!!!).
The first thing which you should likely do is to replace the url’s in your database. There are a couple tools you can use to do this. The first is the ever-popular wp-cli, available at:
https://wp-cli.org/
A 2nd tool is Search-replace by Interconnect It, available from:
https://github.com/interconnectit/Search-Replace-DB/archive/master.zip
either tool should help. You should likely back up your database, just in case you screw the search-&-replace up. That way, you can go back to a known, albeit not actually good, copy. Because the database contains something called “serialized data”, you do need a specialized tool to do a search & replace.
Your other option is to export your posts. You can use the WordPress Importer plugin to do that, &, indeed, WP-Cli requires it to be in place, while the Interconnect It tool does not. This exports files to .xml, on which a search-&-replace using standard text editing tools can be performed. Don’t use a word processor on this–use something like Notepad, etc. The disadvantage of this method is that other tables besides posts & postmeta will not be affected.
Good luck. This is almost always a hassle.
What I’ve done in the recent past is build a new WordPress and make sure it works then install updraft and one or more backup copies you already have from the old site. I then restore the latest backup.
Since you won’t have the domain name anymore (well you could actually have that) you’ll need to account for the new address in your settings and/or database.
https://codex.ww.wp.xz.cn/Changing_The_Site_URL
and https://kinsta.com/knowledgebase/change-wordpress-url/
if you need this info.
Thanks for all your replies,
@jnashhawkins The updraft plugin did not recognize the zip files as their backup, that’s why I decided to restore the files manually. I have also changed the site URLs, which is why the heading part works, but not with the posts, because I didn’t change them.
@abletec I looked at both of your tools and I think I want to use the search-replace, but unfortunately I’m rather unfamiliar with how to use it. Can you please elaborate more on it’s usage? I’ve downloaded it and moved it to my wordpress folder, but activating it through command prompt just opens the file in my notepad.
carnifex08, you can use the Interconnect it tool either from the command line or in your web browser. It sounds to me that either you don’t have PHP enabled in your localhost install or that it’s not on your path.
To use it in your browser, simply invoke it like http://localhost/wordpress-folder/search-replace-folder-name. I use Xampp, my WordPress is installed in a folder named htdocs\wordpress. My Search-Replace is under a folder called srdb in the htdocs folder. So I would invoke it as:
http://localhost/srdb The interface is pretty straightforward.
To invoke wp-cli is a bit more tricky. In windows, it involves making a batch file in your favorite text editor (make sure it’s not a word processor) & name it wp.bat. Make certain it doesn’t have a .bat.txt extension, as Notepad is notorious for adding the .txt extension on if you forget to go to the ‘files of type’ part of the dialog box when saving a file. Here’s what mine looks like.
@echo OFF
d:\xampp\php\php wp-cli.phar %*
& it’s run from the wordpress folder.
Let us know if you have additional questions, & welcome to the WordPress web developer community.
carnifex08, I should’ve also included how to use the interconnect tool via the command line. The file to use is called srdb.cli.php. The command is:
path-to-php\php srdb.cli.php -h host (usually localhost) -n database-name -u username -p password -s search-string -r replace-string
I generally run this from the srdb folder. Your command in full might look something like:
c:\xampp\php\php srdb.cli.php -h localhost -n my-database -u your-db-user-name -p StrongPassword -s domain.com -r http://localhost/wordpress
Obviously, things like my-database are substitutes for your database name, etc, ie, they’re placeholders, since I don’t know the actual name of your database, & please, pretty please, do not post it here in this very public forum (it’s happened). & I emphasize this about the placeholders because, again, this has caused confusion for some. Since I have no idea what you’re running, I’m hoping you can sort of interpolate from my example to your particular situation. Do let us know, though, if you have additional questions or in some way get stuck.
@abletec Alright, so I’ve managed to use the search-replace tool, and I’ve replaced “http://www.sitename.com” with “localhost/sitename”. I checked them on the database and yes, it has all changed. The problem is that the face of the site still hasn’t. It still just displays the header and an “Oops this page can’t be found” under it, and now I get the “require cookies” login error.
This is a really stressful situation, but I thank you and wish for your continued assistance.
I Think u can just use your old website Template and buy a new domain ?
Visit My Blog
So apparently after wracking my brain for 2 days, I’ve come back to the very simple solution of Updraftplus. It didn’t recognize my backups when I uploaded it directly, but by putting it inside the updraft folder then scanning it, it worked perfectly fine. So now I’ve got access to my website offline, and with the search-replace tool the posts are visible as well. It’s just that the format of the pictures are different so that’s one thing I’ll still need to fix.
Thank you for your cooperation