SQL QUERY needed to get POST category (taxonomy) ? – MUST be SQL statement

You can try this SQL query for the taxonomy ‘mi_neighborhoods‘ and let’s take POST_ID = 1304 SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON (tt.term_id = t.term_id) INNER JOIN wp_term_relationships AS tr ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.taxonomy IN (‘mi_neighborhoods’) AND tr.object_id IN (1304) ORDER BY t.name ASC; In general … Read more

How do I filter posts by taxomony using AJAX

I figured it out! Here is the code I used: Add to functions.php: add_action( ‘wp_ajax_nopriv_load-filter2’, ‘prefix_load_term_posts’ ); add_action( ‘wp_ajax_load-filter2’, ‘prefix_load_term_posts’ ); function prefix_load_term_posts () { $term_id = $_POST[ ‘term’ ]; $args = array ( ‘term’ => $term_id, ‘posts_per_page’ => -1, ‘order’ => ‘DESC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘yourtaxonomyhere’, ‘field’ => ‘id’, ‘terms’ => … Read more

Get terms from multiple taxonomies

If you want to retrieve multiple taxonomies you need to put the four taxonomies in an array, you are doing this, but you have put taxonomy=> in the array. $terms = get_terms( ‘taxonomy’ => array( ‘vehicle_safely_features’, ‘vehicle_exterior_features’, ‘vehicle_interior_features’, ‘vehicle_extras’) ); Hope it helps

Taxonomy archives based on Custom Post Type

Here is a complete example made possible using add_rewrite_rule(). The basic setup for this example is documented first, then we’ll get to the real part of the solution using add_rewrite_rule(). Taxonomy and Post Type registration Register the genre taxonomy and the book, movie, and game post types (note that the singular version of each of … Read more

How to add a style to taxonomy edit page

You can do it like this: add_action (‘admin_enqueue_scripts’, ‘wpse_style_tax’) ; function wpse_style_tax () { // these 3 globals are set during execution of {edit-tags,term}.php global $pagenow, $typenow, $taxnow ; if (!in_array ($pagenow, array (‘edit-tags.php’, ‘term.php’)) { return ; } if (‘news’ != $typenow) { return ; } if (‘news-category’ != $taxnow) { return ; } … Read more

Exclude Child Term Posts from Parent Term Archive

Okay, I’ve found an answer. Part of the issue was the missing array @goto10 mentioned, and the other part was that tax_query has required arguments. Here’s what I’m using so far: function exclude_children($wp_query) { if ( isset ( $wp_query->query_vars[‘custom_taxomony’] ) ) { $wp_query->set(‘tax_query’, array( array ( ‘taxonomy’ => ‘custom_taxonomy’, ‘field’ => ‘slug’, ‘terms’ => $wp_query->query_vars[‘custom_taxonomy’], … Read more