Support » Plugin: Taxonomy Meta » How to query for taxonomies that have a custom meta checked?

  • I created a custom meta field of type checkbox and id: is_sticky, like this:

    $meta_sections[] = array(
            'title'      => 'Sticky',             // section title
            'taxonomies' => array('tvr_amenity'), // list of taxonomies. Default is array('category', 'post_tag'). Optional
            'id'         => 'sticky',                 // ID of each section, will be the option name
    
            'fields' => array(                             // List of meta fields
                array(
                    'name' => 'Show in home filters',
                    'id'   => 'sticky',
                    'type' => 'checkbox',
                ),
            ),
        );

    Now I’m trying to get all the taxonomies that has this value checked, like this:

    $types = $types = get_terms( 'tvr_amenity', array(
        'parent'    => '0',
        'hide_empty' => 1,
        'sticky' => 1
     ) );

    But the filter is ignored (all the parent taxonomies are shown), it returns the exact same than:

    $types = $types = get_terms( 'tvr_amenity', array(
            'parent'    => '0',
            'hide_empty' => 1
         ) );

    Any idea what I’m missing, here?

    http://wordpress.org/plugins/taxonomy-meta/

  • The topic ‘How to query for taxonomies that have a custom meta checked?’ is closed to new replies.