Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbachhuber/2649414 to your computer and use it in GitHub Desktop.
Save danielbachhuber/2649414 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;
$users = $wpdb->get_col($wpdb->prepare("SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY %s ASC", $sort ));
foreach ($users as $user) {
$coauthors_plus->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