Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Need to auto select authors on import WordPress

  • SOLVED

I'm importing a ton of custom post types from another WordPress site that have about 500 different authors.

I've moved all of the user IDs to the new site, but the default WordPress import is going to make me manually assign 500+ authors of posts.

This code appears to auto select them:
https://gist.github.com/webercoder/2870698

But I don't know how to get that to work. I need a way to import my custom posts and auto select the authors based on the authors from the past.

Answers (2)

2020-10-28

jpequens answers:

It looks like you have to add that Jquery to the upload process page. Try creating a folder for the jQuery and call it on admin pages.

Create Folder: /admin.js
Call it by adding the following in your function.php:

function admin_enqueue($hook) {
if ('admin.php' !== $hook) {
return;
}
wp_enqueue_script('my_custom_script', get_stylesheet_directory_uri() . '/js/admin.js');
}
add_action('admin_enqueue_scripts', 'admin_enqueue');


You also might be able to use the free version of this: https://wordpress.org/plugins/wp-ultimate-csv-importer/

You might need the premium. But, you can export it first from the one site, and reupload on the new site.


Kyler Boudreau comments:

yeah, thanks. I tried doing that, but it didn't change anything.

2020-10-28

Arnav Joy answers:

How you have imported the post types?


Kyler Boudreau comments:

I imported them to a test site and it doesn't auto assign any of the authors. I know I've seen this work before.