meta option
-
array( 'name' => 'option', 'type' => 'select', 'label' => __( 'Option', 'attachments' ), 'meta' => array( 'allow_null' => false, 'multiple' => true, 'options' => 'my_selector_function', ), ) function my_selector_function(){ //$categories = get_terms( 'portfolio_texonomy', 'orderby=count&hide_empty=0&fields=names' ); global $wpdb; $taxonomies = array( 'portfolio_texonomy' ); $args = array( 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array(), 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', 'hierarchical' => true, 'child_of' => 0, 'childless' => false, 'get' => '', 'name__like' => '', 'description__like' => '', 'pad_counts' => false, 'offset' => '', 'search' => '', 'cache_domain' => 'core' ); $terms = get_terms($taxonomies, $args); $_posts = array(); foreach($terms as $p){ $_posts[$p->term_id] = $p->name; } return $_posts; }
The topic ‘meta option’ is closed to new replies.