Site going down due to slow queries

Perhaps info on this page might help: http://codex.wordpress.org/Class_Reference/wpdb Other than that I would do the usual troubleshooting to start. Backup everything. Turn off all plugins. Switch to a standard WordPress theme like 2015. Then see what errors you are getting now that you have stripped down your install. Then slowly turn things back on until … Read more

Query Problem in Clustom Plugin

It looks like your SQL succeeded to me. So I guess your problem is that you’re getting an array of results (which is probably an array of arrays: rows, then columns per row) when you were expecting a single scalar value. Try using get_var() to get a single value from the database: $DBPresults = $wpdb->get_var( … Read more

get only 1 wpdb and get taxonomy, post to next page [closed]

For 1st question $args = array( ‘post_type’ => ‘us_visa’, ‘posts_per_page’ => -1, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘meta_query’ => array( array( ‘key’ => ‘_Passport’, ‘value’ => $passport_num, ) ) ); $query = new WP_Query( $args ); See Custom Field Parameters of WP_Query on Codex For 2nd question, inside the loop use <?php the_terms( get_the_ID(), … Read more

query using wpdb in wordpress gets me no result

First of all, you escape that query incorrectly… You should use esc_like on the like part and prepare should be used a little bit different: $title1 = ‘Gocomma 10W QI Wireless Fast Charger Car Mount Holder – 2pcs (it)’; $sql = $wpdb->prepare( “SELECT * FROM {$wpdb->posts} WHERE post_title LIKE %s AND post_status=”publish””, ‘%’ . $wpdb->esc_like($title1) … Read more

selecting row using wpdb which contain special symbols

You can try the following query SELECT * FROM `mytable` WHERE `question` = ‘\\\”creating world \\\” written by\?’ In php global $wpdb; $quest=addcslashes(‘\”creating world \” written by?’,’\”?’); $result = $wpdb->get_results(“SELECT * FROM mytable WHERE question ='{$quest}'”);