Support » Plugin: Co-Authors Plus » [Plugin: Co-Authors Plus] Co-authors order when duplicate post

  • alexpike

    (@alexpike)


    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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Sergey Biryukov

    (@sergeybiryukov)

    WordPress Dev

    The solution here would actually be to preserve the order of taxonomy terms in Duplicate Post plugin.

    1. In duplicate-post-admin.php, find duplicate_post_copy_post_taxonomies() function (line 344 in Duplicate Posts 1.1.2).
    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);
      }
    3. 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);
    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    @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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Co-Authors Plus] Co-authors order when duplicate post’ is closed to new replies.