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

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)

    Hand Built

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