0

I use this code to take a post from the post format.

$query = array(
            'showposts' => 5,
            'post_type' => 'post',
            'tax_query' => array(
                'relation' => 'OR',
                array(
                    'taxonomy' => 'post_format',
                    'field'    => 'slug',
                    'terms'    => array( 'post-format-video' )
                ),
            ),
        );

array( 'post-format-standard' ) is not.

How do I pull from standard format ?

Thanks so much.

3

1 Answer 1

0

The terms parameter will only accept custom post types and, like you mentioned, post-format-standard is not one.

Try instead to use the 'NOT IN' operator to test against the custom posts you don't want to display (all in this case):

$query = array(
  'showposts' => 5,
  'post_type' => 'post',
  'tax_query' => array(
    'relation' => 'OR', // You likely don't need this
    array(
      'taxonomy' => 'post_format',
      'field'    => 'slug',
      'terms'    => array( 'post-format-video', 'post-format-image', 'post-format-link', 'post-format-aside', 'post-format-quote', 'post-format-chat', 'post-format-video', 'post-format-chat', 'post-format-audio' ), 
      'operator' => 'NOT IN'
    ),
  ),
);

The thinking here is that it won't display anything but standard posts.

Reference Taxonomy_Parameters

0

Your Answer

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

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