WP_Query equivalent of SQL UNION ALL

You can run 2 wp_query, get the ids and pass those as the post__in parameter to a 3rd wp_query. Not efficient but will do the job. Or you can use a subquery and do it all with just one wp_query. Something like the following: add_filter( ‘posts_where’, ‘myprefix_posts_where’, 10, 2 ); new WP_Query([ ‘post_status’ => ‘publish’, … Read more

updating user in custom wordpress table

There are 2 main issues in your code: Your $wpdb->get_row($prepare) will return either an object or a null, so you can’t do if(count($users) > 0) because $users is not an array. To fix that, just use if ( $users ). There’s a typo here: SET fnmme=%s — the field name should be fname. So you … Read more

SQL phpmyadmin remove posts from cat id exclude condition

finally I find right code with helping by ChatGPT DELETE p FROM wp_posts p INNER JOIN wp_term_relationships tr1 ON (p.ID = tr1.object_id AND tr1.term_taxonomy_id = 2) LEFT JOIN wp_term_relationships tr2 ON (p.ID = tr2.object_id AND tr2.term_taxonomy_id = 20) WHERE p.post_type=”post” AND p.post_status=”publish” AND DATEDIFF(NOW(), p.post_date) > 180 AND tr2.term_taxonomy_id IS NULL; Lets try another way … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)