I want to change the slugs of my terms dynamically

As far as I got you right, the following code is all you need to solve this. function my_function( $post_id ){ if ( ! wp_is_post_revision( $post_id ) ){ $post = get_post( $post_id ); $my_args = array( ‘ID’ => $post_id, ‘post_name’ => ” ); // unhook this function so it doesn’t loop infinitely remove_action( ‘save_post’, ‘my_function’ … Read more

Show one post of each custom taxonomy

assuming all your constants are correct, it should just look like this $terms = get_terms(array(‘taxonomy’ => APP_TAX_STORE)); $tax = get_the_terms($id, ‘coupon_category’); foreach ($terms as $term) { $args = array( ‘post_type’ => APP_POST_TYPE, ‘posts_per_page’ => ‘1’, APP_TAX_TAG => ‘gutschein’, ‘orderby’ => array( ‘meta_value_num’ => ‘DESC’, ‘post_date’ => ‘DESC’, ), ‘tax_query’ => array( ‘relation’ => ‘AND’, array( … Read more

Make taxonomy query dynamic

You can use custom field. For example, you could name it taxonomy, and then in your template, use get_post_meta() to retrieve the taxonomy: $post_id = get_the_ID(); // the ID of the current post $taxonomy = get_post_meta( $post_id, ‘taxonomy’, true ); And change the ‘taxonomy’ => ‘catmaison’ in your code to: ‘taxonomy’ => $taxonomy Example: $terms … Read more