Formating the_terms() function output

While you can specify separators and such in the_terms() arguments, it assumes that you actually want links. You can discard unwanted HTML by using filter: add_filter(‘the_terms’, ‘no_terms_links’, 10, 2); function no_terms_links($term_list, $taxonomy) { if (‘type’ == $taxonomy) return wp_filter_nohtml_kses($term_list); return $term_list; } Or just use deeper get_the_terms() function and iterate through its return to build … Read more

Remove Category description textarea

/*remove term descriptions from post editor */ function wpse_hide_cat_descr() { ?> <style type=”text/css”> .term-description-wrap { display: none; } </style> <?php } add_action( ‘admin_head-term.php’, ‘wpse_hide_cat_descr’ ); add_action( ‘admin_head-edit-tags.php’, ‘wpse_hide_cat_descr’ ); If you need to target it to category editor only – in other words leave description for other taxonomies, then easiest will be to position the … Read more

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

Admin Panel – Disable Moving Selected Terms To Top of Metabox

Try adding this in your functions.php file: // Let’s stop WordPress re-ordering my categories/taxonomies when I select them function stop_reordering_my_categories($args) { $args[‘checked_ontop’] = false; return $args; } // Let’s initiate it by hooking into the Terms Checklist arguments with our function above add_filter(‘wp_terms_checklist_args’,’stop_reordering_my_categories’);

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