wpdb LIKE request shows all database data

Can you verify that $_POST[‘name’] is obtaining a value. I suggest echoing it out to the page for debugging (maybe in comment tags if site is live). If $_POST[‘name’] is empty, then all results will be returned because the query will say user_nicename LIKE ‘%’ Just as a precaution in any case, you should do … Read more

wp_query posts sorting doesn’t work

Thank you, Jacob your suggestion put me into the right direction. This resolved the issue: <a href=”https://wordpress.stackexchange.com/questions/292724/?orderby=title&order=ASC”>Sort By Title</a> <a href=”?orderby=date&order=DESC”>Sort By Date</a> How can I upvote or add +rep you on here? thanks again bro 🙂

How to store queried custom data and use it in multiple pages?

Though it’s not clear exactly what do you want. But, you can do this by two ways. Make a Function like function wpse_1001(){ $contact = new WP_Query(array( ‘post_type’ => ‘contact’ // ‘post_status’ => ‘publish’ )); while($contact -> have_posts()){ $contact -> the_post(); $watsapp = get_field(‘watsapp_no’); $mobile = get_field(‘mobile_no’); $telephone = get_field(‘telephone_no’); $address = get_field(‘address’); } wp_reset_query(); … Read more

query_posts problem – need help

You’ll have to get the terms of current post with get_the_terms function and then use them in your query. // this will get terms and then get only term_ids from them $term_ids = wp_list_pluck( get_the_terms( get_the_ID(), ‘coupon_category’ ), ‘term_id’ ); $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $related = new WP_Query( array( ‘post_type’ => APP_POST_TYPE, … Read more

how to pass args for archive.php query?

The pre_get_posts hook can be used to modify queries before they’re run. You can use $query->set() to set arguments on the WP_Query object, and $query->is_main_query() in the callback to limit your changes to the main query: add_action( ‘pre_get_posts’, function( $query ) { if ( ! is_admin() && $query->is_main_query() ) { $query->set( ‘posts_per_page’, 12 ); } … Read more

How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query

while ( $loop->have_posts() ) : $loop->the_post(); //Edit Width post type $categories = get_the_terms(get_the_ID(), ‘services’); $separator=”, “; if ( ! empty( $categories ) ) { foreach( $categories as $category ) { echo ‘<a class=”cat_item” href=”‘ . esc_url( get_category_link( $category->term_id ) ) . ‘” alt=”‘ . esc_attr( sprintf( __( ‘%s’, ‘your-themes’ ), $category->name ) ) . ‘”>’ … Read more