WordPress.org

Ready to get started?Download WordPress

Forums

Sort with args from array (2 posts)

  1. willee
    Member
    Posted 9 months ago #

    This is my $args:

    $args=array(
        'post_status'       => 'publish',
        'post_type'         => 'products',
        'tax_query'         => array(
            array(
                'taxonomy'  => 'product_categories',
                'terms'     => explode(',', $groups_separated),
                'field'     => 'slug',
            )
        ),
        'posts_per_page'	=> 30
    );

    I would like to sort $args by the order of the terms that is being passed to it in $groups_separated

    Is this possible? If so, how would I go about it?

  2. vtxyzzy
    Member
    Posted 9 months ago #

    The code in this pastebin might help: http://pastebin.com/3vwiDSfb

    Replace the $id_array with the array from explode(',', $groups_separated).

Reply

You must log in to post.

About this Topic

Tags