alexpike
Member
Posted 6 months ago #
Hi. Have an interesting issue. I use Duplicate post plugin so when i duplicate some post the order of author and co-authors changes as usual.
What i mean exactly:
in original post
Author 1
Author 2
Author 3
Author 4
when duplicate
Author 3
Author2
Author 1
Author 4
Is it possible to fix it cause i need the same authors order as in original post?
http://wordpress.org/extend/plugins/co-authors-plus/
The solution here would actually be to preserve the order of taxonomy terms in Duplicate Post plugin.
- In
duplicate-post-admin.php, find duplicate_post_copy_post_taxonomies() function (line 344 in Duplicate Posts 1.1.2).
- Find this code:
$post_terms = wp_get_object_terms($id, $taxonomy);
for ($i=0; $i<count($post_terms); $i++) {
wp_set_object_terms($new_id, $post_terms[$i]->slug, $taxonomy, true);
}
- Replace with:
$post_terms = wp_get_object_terms($id, $taxonomy, array( 'orderby' => 'term_order' ));
$terms = array();
for ($i=0; $i<count($post_terms); $i++) {
$terms[] = $post_terms[$i]->slug;
}
wp_set_object_terms($new_id, $terms, $taxonomy, false);
@lopo What do you think about making this improvement to your Duplicate Post plugin?
I will defitely add it to next version, thanks for the suggestion!