Weekdays as terms – How to order taxonomy terms by ID in admin panel?

Method #1 – Modifying the query arguments If we want to modify the term order for the schedule_day_taxonomy term checklist, on the single schedule cpt edit screen, then we can use the following setup: add_action( ‘load-post.php’, function() { add_filter( ‘wp_terms_checklist_args’, ‘wpse_terms_checklist_args’ ); } ); function wpse_terms_checklist_args( $args ) { // Target the ‘schedule’ custom post … Read more

WP REST API – get custom taxonomies based on terms & filter

Herewith find the below answer for my own question for the custom taxonomies based listing the categories add_action( ‘init’, ‘rest_custom_category_request’, 25); function rest_property_type_category_request(){ global $wp_taxonomies; $wp_taxonomies[‘custom_category’]->show_in_rest = true; $wp_taxonomies[‘custom_category’]->rest_base=”custom_category”; $wp_taxonomies[‘custom_category’]->rest_controller_class=”WP_REST_Terms_Controller”; } Answer for the filter with custom meta key & values add_filter(‘rest_query_vars’, ‘custom_rest_query_vars’); function custom_rest_query_vars($query_vars) { //print_r($query_vars);exit; $query_vars = array_merge( $query_vars, array(‘meta_key’, ‘meta_value’, ‘meta_compare’) ); … Read more

Get posts by Taxonomy without terms

You may do it by this method. $media_category = get_terms(‘media_category’); foreach($media_category as $cat) { wp_reset_query(); $args = array(‘post_type’ => ‘your_post_type’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘media_category’, ‘field’ => ‘slug’, ‘terms’ => $cat->slug, ), ), ); $loop = new WP_Query($args); if($loop->have_posts()) { // echo $cat->name; while($loop->have_posts()) : $loop->the_post(); echo get_the_title(); endwhile; } }

Having Issue on Passing Variable into HTML Class Tag

Right, that’s because “get_the_term_list” returns an html string of tags… Those won’t work well as class attributes! : ) I suspect what you want is wp_get_post_terms instead: $terms = wp_get_post_terms( get_the_ID(), ‘type’, array(‘fields’ => ‘slugs’) ); // array of term slugs echo ‘<div class=”element-item’.implode(‘ ‘, $terms).'”>’; Hope this helps!