Nested select statements not working

You need to identify the tables for each of the columns that have the same name. You should also be using an IN statement and not = for the department. I can’t test this since I don’t have your DB but you can try this: $sql = $wpdb->get_results(“SELECT * FROM ” . $wpdb->prefix . “dir_personnel … Read more

My custom pagination not displaying

You will pass the $wpex_query object into wpex_pagination function. Currently $wp_query object is not getting your custom query details. Here is the updated for wpex_pagination function. if ( !function_exists( ‘wpex_pagination’ ) ) { function wpex_pagination( $new_query ) { $prev_arrow = is_rtl() ? ‘→’ : ‘←’; $next_arrow = is_rtl() ? ‘←’ : ‘→’; global $wp_query; $temp_query … Read more

SQL query to delete users with multiple meta keys and comments

So i got the answer and solution here https://stackoverflow.com/questions/55142768/sql-for-wp-to-delete-users-with-multiple-meta-keys-and-comments/55142835#55142835 SELECT u.* FROM wp_users u WHERE NOT EXISTS (SELECT 1 FROM wp_usermeta um WHERE u.ID = um.user_id AND um.meta_key IN (‘metakey1’, ‘metakey2’) ) AND NOT EXISTS (SELECT 1 FROM wp_comments c WHERE u.ID = c.user_id );

Query Post interferes with Pagination

query_posts() is going to alter the main query, and it doesn’t sound like you want that. I would recommended using the WP_Query object to get the other posts. That said, if you must use query_posts(), call wp_reset_query() at the end of your foreach to reset your main query back to the original one.

Restrict WordPress search to a single ACF field

I ended up using a simple meta_query: $args = [ ‘post_status’ => ‘publish’, ‘post_type’ => $post_type, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘my_acf_field’, ‘value’ => $search_term, ‘compare’ => ‘LIKE’ ), ) ]; $query = new WP_Query($args);

WordPress add_query_arg from ajax and make url friendly

This add_query_arg function is add argument after URL you have enter. You have to get pretty URL so add below code in your functions.php file : function custom_rewrite_rule() { add_rewrite_rule(‘^cars/([^/]*)/([^/]*)/?’,’index.php?page_id=PAGE_ID&type=$matches[1]&models=$matches[2]’,’top’); flush_rewrite_rules(); } add_action(‘init’, ‘custom_rewrite_rule’, 10, 0); function custom_rewrite_tag() { add_rewrite_tag(‘%type%’, ‘([^&]+)’); add_rewrite_tag(‘%models%’, ‘([^&]+)’); } add_action(‘init’, ‘custom_rewrite_tag’, 10, 0); add_action( ‘wp_ajax_get_prepare_link’, ‘prepare_link’); add_action( ‘wp_ajax_nopriv_get_prepare_link’, ‘prepare_link’); function … Read more

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