0
$args = array(
        'post_type'         => 'videolesson',
        'ordeby'            => 'rand',
        'order'             => 'DESC',
        'posts_per_page'    => 8,
            'tax_query' => array(
                array(
                    'taxonomy' => 'level',
                    'field' => 'slug',
                    'terms' => 'beginner',
                    'operator' => 'IN',
                    array(
                        'taxonomy' => 'vidsubjects',
                        'operator' => 'EXISTS'
                    ),
                ),
            ),
    );
    $getting = new WP_Query( $args );
2
  • Note that your orderby random is going to be expensive ( unexpectedly expensive getting more expensive/slow as the number of posts rises ), you also misspelt orderby. I would also question why a random ordering would be descending, random has no order
    – Tom J Nowell
    Commented Jun 21, 2017 at 13:19
  • I need get posts type = videos, your taxonomies in case tax = beginner for differect tax = subjects. Commented Jun 21, 2017 at 19:45

1 Answer 1

0

try this..

$args = array(
            'post_type'         => 'videolesson',
            'ordeby'            => 'rand',
            'order'             => 'DESC',
            'posts_per_page'    => 8,
                'tax_query' => array(
                    'relation' => 'AND',
                    array(
                        'taxonomy' => 'level',
                        'field' => 'slug',
                        'terms' => 'beginner',
                        'compare' => 'IN',

                    ),
                    array(
                       'taxonomy' => 'subjects',
                       'operator' => 'EXISTS'
                    )

                ),
        );
        $getting = new WP_Query( $args );
2
  • i don't know if that works similarly or not but what i did here is take an array one level out Commented Jun 21, 2017 at 14:21
  • I need get posts type = videos, your taxonomies in case tax = beginner for differect tax = subjects. @Howdy_McGee Commented Jun 23, 2017 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.