Skip to content

Instantly share code, notes, and snippets.

@jp1971
Created May 9, 2012 21:11
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jp1971/2648864 to your computer and use it in GitHub Desktop.
Create guest authors from users
<?php
//Quick and dirty for the sake of initial testing
require_once('wp-load.php');
function create_coauthors_from_users() {
global $wpdb;
global $coauthors_plus;
$sort = 'ID';
$users = $wpdb->get_col($wpdb->prepare("SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY %s ASC", $sort ));
foreach ($users as $user) {
$coauthors_plus->guest_authors->create_guest_author_from_user_id($user);
}
}
create_coauthors_from_users();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment