Is the only way to add taxonomy terms via an admin panel?

I think you are looking for wp_insert_term(). An example from the Codex: $parent_term = term_exists( ‘fruits’, ‘product’ ); // array is returned if taxonomy is given $parent_term_id = $parent_term[‘term_id’]; // get numeric term id wp_insert_term( ‘Apple’, // the term ‘product’, // the taxonomy array( ‘description’=> ‘A yummy apple.’, ‘slug’ => ‘apple’, ‘parent’=> $parent_term_id ) );

How to display Custom taxonomy on custom post listing page [duplicate]

You can get terms by posts with this functions. $term_list = wp_get_post_terms($post->ID, ‘my_taxonomy’, array(“fields” => “ids”)); And echo or use different with foreach(). This tip get terms with ID. You can get another properties. wp_get_post_terms() in codex. Get term by id and taxonomy => $term = get_term($term_id, ‘my_taxonomy’); Get term name by id => $term->name; … Read more

Nested Accordions For Taxonomies [closed]

I’m sure you can find accordion code samples anywhere. It might be helpful to convert terms into a structure that is more conducive to nested elements. <?php // Get terms as nested array function get_nested_terms ($taxonomy, $array=array(), $args=array() ) { $args = wp_parse_args($args, array( ‘orderby’ => ‘count’, ‘parent’ => 0, ‘hide_empty’ => true )); $terms … Read more

How much worse is querying custom fields compared to custom taxonomies, quantitatively

The trouble with meta queries is they require an additional join per filter. Say you have a property site, and you’re searching by location, rooms and price. That’s three joins. If you were using taxonomies, just two (terms and term_taxonomy) – no matter how many filters. The other reason taxonomies tend to beat meta queries … Read more

Advise on Custom Taxonomies and Structure

That’s how you resister taxonomy. This will add author as taxonomy <?php /** * @uses Register Book Author Taxonomy * @uses Adds query vars * @author Nirpendra Patel * @return void **/ function reg_tax_author() { $authors = array( ‘name’ => _x( ‘Authors’, ‘Taxonomy plural name’, ‘b_thebookstore’ ), ‘singular_name’ => _x( ‘Author’, ‘Taxonomy singular name’, ‘b_thebookstore’ … Read more

Get all post from custom post type in custom taxonomy

i think you posted the different code earlier. But if this is the code you are using right now then you should so this $slide = new wp_query( array ( ‘post_type’ => ‘banner’ , ‘tax_query’ => array( array( ‘taxonomy’ => ‘country’, ‘field’ => ‘name’, ‘terms’ => ‘algeria’ ), ), ‘meta_query’ => array( ‘relation’ => ‘AND’, … Read more

An unidentified error has occurred when deleting a category

Your taxonomy registration in your example is showing this: function insurance_all_category(){ $labels = array( ‘name’ =>_x( ‘Insurance all category’, ‘taxonomy general name’ ), ‘singular_name’ => _x( ‘Category’, ‘taxonomy singular name’ ), ‘search_items’ => __( ‘Search Category’ ), ‘all_items’ => __( ‘All Categories’ ), ‘parent_item’ => __( ‘Parent Category’ ), ‘parent_item_colon’ => __( ‘Parent Category:’ ), … Read more