Co-Authors-Plus
Co-Authors-Plus copied to clipboard
Migrating from custom system, and not able to keep the order in authors. Wrong sorting.
Hello,
We are currently migrating from another custom system to co-authors. We are having a lot of trouble with the migration since the ordering of authors seems to be completely random. Sometimes (most of the time) respects the old order, but sometimes it doesn't. Maybe the way we are doing it it's wrong (?)
How are we doing it? Passing an array of authors (with user_nicename) to add_coauthors function.
global $coauthors_plus;
$new_co_authors = [ 'Jhon Doe', 'Test User'];
$coauthors_plus->add_coauthors( $post_id, array_map( 'sanitize_title', $new_co_authors ) );
Sometimes we will get co-authors in the right other, sometimes inverse.
Why the order is sometimes not respected? I tried other combinations, like calling add_coauthors with just one author, n times. Nothing seems to work, and all the time seems random.
Any clues? Are we doing it wrong?
Thanks,