Filtering post by category?
-
Hi. I’m using the Post metabox but I can’t figure out how to filter displayed posts by category.
My code look like this:
array( 'name' => __( 'News', 'news' ), 'id' => "{$prefix}news", 'type' => 'post', // Post type 'post_type' => array('news'), // Field type, either 'select' or 'select_advanced' (default) 'field_type' => 'select', 'multiple' => true, 'placeholder' => __( 'Select post', 'news' ), // Query arguments (optional). No settings means get all published posts 'query_args' => array( 'post_status' => 'publish', 'posts_per_page' => 30, 'orderby' => 'date', 'order' => 'DESC', ), ),
But if I add the category parameters, something like this:
'posts_per_page' => 30, 'orderby' => 'date', 'order' => 'DESC', 'category-name' => 'internal-news'
the post aren’t displayed.
I’m doing something wrong?
Thanks in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Filtering post by category?’ is closed to new replies.