Save WordPress Posts From Expired Domain Blog – I let some of my domains expire but had WordPress blogs on them so wanted to save the posts. You can do this from cPanel by exporting the posts data in PHPMyAdmin.
To login to cPanel where the domain name no longer works, simply use the IP address of the hosting for the URL e.g. 126.96.36.199/cpanel
Then, in PHPMyAdmin, navigate to the wp_posts table, and export the data.
Under the export options you can export as SQL, but in this example we will use the PHP Array option. This causes the table data to be downloaded as a .php file.
I wrote a small PHP script to process this data and save all the posts as text files which could be used for articles or new blog post content.
Here is the code:
include “posts.php”; // This is the PHP Array file that was saved.
foreach($wp_posts as $row)
if ($row[‘post_type’] == “post”)
$content = $row[‘post_title’] . “\n\n” . $row[‘post_content’];
$fn = “posts/” . $row[‘post_name’] . “.txt”;
Before running the code, create a posts directory under the code location, and copy the posts data php file to posts.php in the code location.
If you saved the code in htdocs/dump/index.php run it with say localhost/dump/ Then it will list all the files that it saved.