How to create a WP folder
-
I migrated from Blogger to WordPress. I managed to fix about 50% of my blogger post urls so they now redirect to WordPress. But I was told to upload the following php script to a wordpress folder to fix the rest. The problem is, I can’t find a folder or would it be a plugin folder? If it is a plugin then what type of plugin?
………………………………………………………………………………………………..
Here is the code and instructions.At this point you can use the following php script. Just copy-paste following codes into a file with name like fix.php and save/upload it to the WordPress folder. Then just open its URL from the browser. URL will be like: https://example.com/fix.php (replace example.com with your domain name).
<?php
require_once(‘wp-load.php’);
$res = $wpdb->get_results(“SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = ‘blogger_permalink'”);
$wpdb->print_error();
foreach ($res as $row){
$slug = explode(“/”,$row->meta_value);
$slug = explode(“.”,$slug[3]);
$wpdb->query(“UPDATE $wpdb->posts SET post_name ='” . $slug[0] . “‘ WHERE ID = $row->post_id”);
$wpdb->print_error();
}
echo “DONE”;
?>
- The topic ‘How to create a WP folder’ is closed to new replies.