Skip to content

WordPress Import Posts – Assign to Existing Author

When importing posts, pages, or custom posts from an existing WordPress installation, it asks you whether you want to import a user, assign to a new user, or assign to an existing user.

If you have already imported users, you want to assign all posts to existing users. However, if you have a lot of users, it can be a real pain. In my case, I had 7 imports and over 50 users per import to assign to.

Here’s a script that you can run in your inspector console to instantly fill all select options to the correct user.

First, include jQuery.

Then, run the following script:

It grabs the name from the bolded text above each select, finds the option with that text, and makes it selected.

5 Comments

  1. I had to comment to say thank so much for this – you have no idea how much time you just saved me 🙂 great stuff!

    • Stephen Saucier Stephen Saucier

      Glad to help!
      I know I was a bit horrified that I would have to do all that manually..

  2. campsjos campsjos

    Thank you Stephen. You saved me from a loooong and boring day of work.

  3. I’ve spent a month moving from a custom CMS w 20k+ authors and 100k+ articles, and this saved me SO much times. Huuuuuuge thanks!!

Leave a Reply