WordPress.org

Ready to get started?Download WordPress

Forums

Post Types Order
[resolved] tax_query with Advanced Post Types Order? (2 posts)

  1. spectrus
    Member
    Posted 1 year ago #

    Hi,

    I've got a WP_Query with tax_query parameter in one of my plugins, which gets posts based on two custom taxonomies (below). I'd like to be able to sort posts that are returned with it using the plugin. I am able to filter posts by those taxonomies in the 'Re-Order' sub-menu, however rearranging them has no effect on the output. Can anything be done?

    $args = array(
        'tax_query' => array(
          'relation' => 'AND',
          array(
            'taxonomy' => 'gender_category',
            'field' => 'slug',
            'terms' => array( $_POST['gender'] )
          ),
          array(
            'taxonomy' => 'age_category',
            'field' => 'slug',
            'terms' => array( $_POST['age'] )
          )
        )
      );

    http://wordpress.org/extend/plugins/post-types-order/

  2. nsp-code
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Spectrus,
    I see what you mean. The order within the admin is set for individual taxonomies term, but when a query fetch objects from multiple taxonomies/terms, there is no order to apply, for which reason this will fall under the Archive custom order, you should try to re-order that instead.
    Hope it works for you.

    Please feel free to contact us directly for a much faster correspondence as you own a paid code.

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic