WordPress.org

Ready to get started?Download WordPress

Forums

Custom Taxonomy Sort
How to sort tax_query? (2 posts)

  1. gleenk
    Member
    Posted 2 years ago #

    I'm a in a Custom Page and I've installed Custom Taxonomy Sort plugin (turning off automatic sorting). This is my query (not-sorting):

    $args=array(
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'portata',
    			'field' => 'slug',
    			'terms' => array( 'primi-piatti','secondi-piatti')
    		)
    	),
      'post_type' => 'ricetta',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'orderby' => 'custom_sort'
    );
    $my_query = null;
    $my_query = new WP_Query( $args );

    How can I make it works?

    http://wordpress.org/extend/plugins/custom-taxonomy-sort/

  2. Zack Tollman
    Member
    Plugin Author

    Posted 2 years ago #

    Hi gleenk,

    Custom Taxonomy Sort does not apply to WP_Query. It only applies to when you are querying for taxonomy terms through functions like get_terms.

    Unfortunately, my plugin will be of little use to you in this circumstance; however, I suppose you could use the data stored in the termmeta table to sort the posts only after the query is executed.

    There's also a chance that you can do what you are trying to do that does not involve my plugin at all.

    Best,

    Zack

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic