Rewrite rule taxonomy url with different values in one function

You can do that using a subpattern or capturing group like ([a-z]) in your rewrite rule’s regex (i.e. regular expression pattern, which is the 1st parameter for add_rewrite_rule()), and then use $matches[<n>] in your query (the 2nd parameter for add_rewrite_rule()), where <n> is a number (1 or above) and it’s the subpattern’s position number. Why … Read more

WordPress Two Level Filters on Getting Custom Taxonomy Terms

It doesn’t make any sense querying with get_terms when: genre=”action” AND quality = ‘HD’ The reason is: The only term that has taxonomy genre equals to action, is action. And the only term that has taxonomy quality equals to HD, is HD. If you constrain them with AND, then basically you have nothing. Since there’s … Read more

delete_term is not working properly with add_action()

AFAIK, slug is unique. So $post_cat_term = get_term_by( ‘slug’, $deleted_term->slug, ‘category’ ); shouldn’t return anything. Instead, you may try name. Also, delete_term callback gets 5 parameters, so it’s better to adjust that accordingly. See if the following works: function delete_similar_term( $term_id, $tt_id, $taxonomy, $deleted_term, $object_ids ) { if( $deleted_term->taxonomy === ‘movies_category’ ) { $post_cat_term = … Read more

How to get tags only with custom meta field and display them randomly?

You can get custom fields randomly using the below code that you can combine with your existing code to get desired output. function wpll_get_popular_nodes() { global $wpdb; $custom_fields = $wpdb->get_results( “select DISTINCT meta_value from $wpdb->postmeta pt LEFT JOIN $wpdb->posts p ON (pt.post_id = p.ID) where meta_key LIKE ‘tax_image_url_universal’ ORDER BY RAND()” ); if ( is_array( … Read more