Custom category page with taxonomy filters

The solution: Add ‘operator’ => ‘AND’, to the tax_query. ‘tax_query’ => array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘offer’, ‘field’ => ‘slug’, ‘terms’ => array($offer), ‘operator’ => ‘AND’, ), array( ‘taxonomy’ => ‘network’, ‘field’ => ‘slug’, ‘terms’ => array($network), ‘operator’ => ‘AND’, ),

Show posts by category – category ID not working

Of course it doesn’t work. What examples are using this code? Let’s take a look at Category Parameters of WP_Query There are 5 category parameters: cat (int) – use category id. category_name (string) – use category slug. category__and (array) – use category id. category__in (array) – use category id. category__not_in (array) – use category id. … Read more

Slow Query with more 100 products

So you want only the “first” products having a unique product_cip? I think a direct MySQL Query may be quicker: function get_all_product_in_selected_category($atts){ // Get the category if(!(isset($atts[‘category_id’]) || !is_numeric($atts[‘category_id’])){ return 0; } $catsearched = $atts[‘category_id’]; global $wpdb; $productssql = “SELECT min($wpdb->posts.ID), meta_value FROM $wpdb->posts INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON … Read more

From admin edit user page query either the user_nicename or username field value of the user profile being edited or viewed

To get the username of a user you can use the get_userdata() function. Pass it the users ID $user = get_userdata($user_id); Then the have access to the username or user_login as its called echo $user->user_login; You can read more about this function here: https://codex.wordpress.org/Function_Reference/get_userdata Or if you need to get the user by other information, … Read more