Support » Plugin: Co-Authors Plus » Unable to re-order author names

  • Cogdiss


    I’m using co-authors plus on a site to display writer and photographer information – I’ve set up the single post templates in my child theme so the plugin shows ‘Words by’ before the first author and ‘Photos by’ between the final two authors.

    However, the re-ordering function of the plugin doesn’t seem to be working correctly. I can add a second author and drag the authors around to change the order, but whenever I save or update the post they revert to alphabetical order.

    Can you think of any reason why this might be happening? I can give you access to the WordPress dashboard on the site if that would help you troubleshoot.



Viewing 3 replies - 1 through 3 (of 3 total)
  • Musiphilos


    Hi Hannah,

    This problem is probably related with my own thread in

    I’m guessing there is a mismatch between this plugin and the new wordpress core code.

    Any one has an efficient method to contact the authors about this?

    I’m willing to pay for someone to “hack” the code around this. Please contact me:

    I have been able to develop a “nasty hack” that corrects the bug in the code.

    In “co-authors-plus.php” file, insert the substitute the following fucntion:

    public function get_coauthor_terms_for_post( $post_id ) {
    		if ( ! $post_id ) {
    			return array();
    		$cache_key = 'coauthors_post_' . $post_id;
    		$coauthor_terms = wp_cache_get( $cache_key, 'co-authors-plus' );
    		if ( false === $coauthor_terms ) {
    			$coauthor_terms = wp_get_object_terms( $post_id, $this->coauthor_taxonomy, array(
    				'orderby' => 'term_order',
    				'order' => 'ASC',
    			) );
    			/* ----------- DAFONSO START  -------------*/
    			global $wpdb;
    			$i = 0;
    			foreach ($coauthor_terms as $coauthor_term)
    				//echo '<h3>var_dump</h3>';
    				$querystr = 'SELECT * FROM <code>wp_cdrs_term_relationships</code> where <code>object_id</code>='.$post_id.' and <code>term_taxonomy_id</code>='.$coauthor_term->term_id;
    				$custom_query = $wpdb->get_results($querystr, OBJECT);
    				$aux = $custom_query[0]->term_order;
    				$coauthor_terms[$i]->term_order = $aux; //Replace the inexistente Term_order
    				$coauthor_terms_sorted[$aux] = $coauthor_terms[$i];
    			for ($x = 0; $x <= $i; $x++) {
    				$aux2[$x] = $coauthor_terms_sorted[$x];
    			$coauthor_terms = $aux2;
    			//echo '<h3>var_dump coauthor_terms</h3>'; var_dump($coauthor_terms);
    			/*--------- DAFONSO END-----------------*/
    			// This usually happens if the taxonomy doesn't exist, which should never happen, but you never know.
    			if ( is_wp_error( $coauthor_terms ) ) {
    				return array();
    			wp_cache_set( $cache_key, $coauthor_terms, 'co-authors-plus' );
    		return $coauthor_terms;


    Hi Musiphilos,

    Does your script work for you ?
    I tried it but the result is that it shows only the default author. All the co-authors are not showing anymore !

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unable to re-order author names’ is closed to new replies.