Support » Plugin: Meta Box » Filtering post by category?

  • Resolved chavo

    (@chavo)


    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.

    https://wordpress.org/plugins/meta-box/

Viewing 1 replies (of 1 total)
  • Forged about it!

    I figured out that I was filtering by “category” instead the custom taxonomy “category-news”. I feel like a fool!

Viewing 1 replies (of 1 total)
  • The topic ‘Filtering post by category?’ is closed to new replies.