get_users is missing or skipping over users in loop

Your problem is a basic PHP problem. You’re only looping over the even numbers, 0, 2, 4, 6 This is because at the end of every loop $offset increases by 1: for($offset = 0; $offset < 100; $offset++) But then for some reason it also gets incremented before the loop ends: $offset++; So offset is … Read more

wp_is_mobile dequeue not working

It looks like you are using the script “src” rather than the script “handle”. Have you tried: add_action( ‘wp_enqueue_scripts’, ‘remove_plugin_scripts’, PHP_INT_MAX ); function remove_plugin_scripts() { if ( wp_is_mobile() ) { // Remove script file. wp_dequeue_script( ‘tp-tools’ ); wp_deregister_script( ‘tp-tools’ ); wp_dequeue_script( ‘revmin’ ); wp_deregister_script( ‘revmin’ ); } }

Combining sorted and random CPT

Try to get two different arrays of posts and loop through array A. Before get post data of A element get random element from array B. For example: $array_a = [‘post_id_a1’, ‘post_id_a2’, ‘post_id_a3’]; $array_b = [‘post_id_b1’, ‘post_id_b2’, ‘post_id_b3’]; foreach ( $array_a as $a_post_id ) { $is_b_should_displayed = mt_rand( 0, 1 ); if ( $is_b_should_displayed && … Read more

Meta Query relation “AND” not working

You mixed meta query and tax query It should look like this $query = array( ‘post_type’ => ‘product’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 12, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘meta_query’ => array( array( ‘key’ => ‘_stock_status’, ‘value’ => ‘instock’ ) ), ‘tax_query’ => array( array( ‘taxonomy’ => ‘product_visibility’, ‘field’ => ‘name’, ‘terms’ => ‘featured’ … Read more

Query custom post type by category slug

I’ve got an answer that worked perfeclty for me in another forum, so I’ll post here if sometime anyone gets a similar problem $argsPost = array( ‘post_type’=>’album’, ‘orderby’=>’date’, ‘order’ => ‘DESC’, ‘posts_per_page’=>’4’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘albuns_categories’, ‘field’ => ‘slug’, ‘terms’ => array( ‘ANYTERM’ ), ‘operator’ => ‘IN’ ) ) ); =D

Add condition of user capability in WP_query

#SOLVED# Issue is solved by defining the meta_query conditions with an if statement. So if current_user_can(‘subscriber’) the meta_query includes the conditions, otherwise the query includes all posts. This is the code in case this is helpful for anyone else: <?php //create variables $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; … Read more