How to add autocomplete to custom taxonomy for CPT

The logic in the tax query is very unlikely to verify true. Look at it: ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘zip_code’, ‘field’ => ‘slug’, ‘terms’ => array( $term ), ), array( ‘taxonomy’ => ‘city_served’, ‘field’ => ‘slug’, ‘terms’ => array( $term ), ), ), If you read the tax query, it … Read more

Custom post type custom taxonomy archive page name

If you need the archive index for a custom taxonomy, you would use taxonomy-{taxonomy}.php template file. So, if you’ve created a custom taxonomy, gallery-exhibitions, the archive index for this taxonomy would use the taxonomy-gallery-exhibitions.php template file. If you need the archive index for terms for your custom taxonomy, you would use taxonomy-{taxonomy}-{term}.php template file. So, … Read more

How to preserve edits to Name or Slug of term when using wp_update_term on save?

So, thanks to cjbj I finally found the correct answer! I needed to use edited_term instead of edit_term. Very subtle difference. edited_term fires after a term has been saved. // insert stuff into description field of taxonomy function insert_taxonomy_content( $term_id, $tt_id, $taxonomy ){ // only insert content on certain taxonomies if ( $taxonomy === ‘some_custom_taxonomy’ … Read more

PHP Fatal error: Cannot use object of type WP_REST_Response as array in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

Nobody pointed out I was using ‘$data’ incorrectly. function dept_cat_api( $request ) { $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘crosspost’, ‘field’ => ‘slug’, ‘terms’ => array( $request[‘dept’] ), ), array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( $request[‘cat’] ), ), ), ); $posts = … Read more

Sorting taxonomy columns by meta value numeric

The code I am posting is a modified and simplified version of yours. I got my solution using your code. /** * Filter WP_Term_Query meta query * * @param object $query WP_Term_Query * @return object */ function filter_terms_clauses( $pieces, $taxonomies, $args ) { global $pagenow, $wpdb; if(!is_admin()) { return $pieces; } if( is_admin() && $pagenow … Read more

Change permalink of post if it belongs to custom taxonomy

You can modify the permalinks using the the_permalink filter and add a rewrite rule using add_rewrite_rule to redirect the new permalinks to the standard post link. function mysite_modify_permalink($url) { global $post; //if taxonomy archive for Series get term $term = is_tax(‘Series’)?get_query_var(‘term’):”; if(empty($term)) { //if no term was found //get all Series terms for current post … Read more