Conditional posts in WP_query for search

What about removing the if statement, and combining the queries into something like this: ‘meta_query’, array( ‘relation’ => ‘OR’, array( array( ‘relation’ => ‘AND’, array( ‘key’ => ‘am_get_recurring_count’, ‘compare’ => ‘=’, ‘value’ => ‘0’, ), array( ‘relation’ => ‘OR’, array( ‘key’ => ‘am_enddate’, ‘compare’ => ‘>=’, ‘value’ => $currentdate, ), array( ‘key’ => ‘am_enddate’, ‘compare’ … Read more

$query->set( ‘post_type’, ‘post’ ); not working

After Milo’s help I found a function where it altered the search query: if( is_search() && empty($_GET[‘post_type’]) && !is_admin() ) { global $wpdb; $query = get_search_query(); $query = $wpdb->esc_like( $query ); $where .= ” OR {$wpdb->posts}.ID IN (“; $where .= “SELECT {$wpdb->postmeta}.post_id “; $where .= “FROM {$wpdb->posts}, {$wpdb->postmeta} “; $where .= “WHERE {$wpdb->posts}.post_type=”page” “;<-page to … Read more

Auto search field without buttons, shows first result from search page

You need to search for more information on AJAX. There are some plugins that may do what you are looking for such as: https://wordpress.org/plugins/ajax-search-lite/ Alternatively, if you want to try and develop the code yourself, have a look at the following: https://stackoverflow.com/questions/11166981/how-to-use-jquery-to-retrieve-ajax-search-results-for-wordpress https://premium.wpmudev.org/blog/how-to-use-ajax-in-wordpress-to-load-search-results/

How to order users alphabetically by name? in plugin UPME

Diana you must change line of code in this array $args = array( ‘exclude’=> $admin_users_list, ‘number’ => $limit, ‘orderby’ => ‘registered’, ‘order’ => ‘desc’, ‘meta_query’ => array( ‘relation’ => ‘AND’, 0 => array( ‘key’ => ‘upme_user_profile_status’, ‘value’ => ‘ACTIVE’, ‘compare’ => ‘=’ ), 1 => array( ‘key’ => ‘upme_approval_status’, ‘value’ => ‘ACTIVE’, ‘compare’ => ‘=’ … Read more

Customizing Google’s Search box in WordPress [closed]

This isn’t really a wordpress specific question, but you’ll have to start by adding the classes you have in your search form to the Google code, until you get the results you desire. Without seeing all of your backend, it’s hard to say what you need to do exactly, but this should get you on … Read more

How to make MySQL search queries with quotes

Woah there. You’ve just opened up a can of SQL injection. I use the default get_query_var(‘s’) that I believe is automatically escaped by wordpress. Not quite – get_search_query() will do that, but get_query_var( ‘s’ ) gets the “raw” value. Regardless, always use wpdb::prepare or similar escaping before executing SQL: $query = $wpdb->prepare( “SELECT * FROM … Read more

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