WordPress Unknown Query

It is not hard to log queries performed by WordPress. Simplest way would be to use plugin such as Debug Bar that collects backtrace information about where in code was query performed.

How to get one result using wpdb class?

You’ve made no attempt to check for errors, e.g. $result may be false, also your code would fail if there was more than one result returned. So instead of using a custom table, and reinventing the wheel, use the provided APIs: get_theme_mod and set_theme_mod So your code now becomes: function asec_get_link_color( $default_color=”blue”) { return get_theme_mod( … Read more

How much does $wpdb->prepare(), then $wpdb->query() VS straight $wpdb->query(), can slow down the load time of whole page

$wpdb->prepare shouldn’t make any significant difference. As you can see here (https://developer.wordpress.org/reference/classes/wpdb/prepare/#source), it doesn’t do much. It’s just taking care of proper escaping and formatting variables, so the final query is safe to run. So if you’re asking if there is a big difference between $wpdb->query( $wpdb->prepare( … ) ) and $wpdb->query( <SAFE_SQL> ), then … Read more

WordPress: paginating array using a foreach

I ended up using this method… http://www.lotsofcode.com/php/php-array-pagination.htm This script will allow you to take an array and paginate across multiple pages. Works good for what i need. Just working on how to number each item in the array across the pages in a descending order…

Ajax Query returns zero

if ajax returns zero, the function bound is not registered properly have a read: http://arresteddeveloper.net/woocommerce-get-variation-description-variation-select-changes/ this might point you in the right direction

How to query different categories on index?

You could get the categories and for each of them, you use the list category posts plugin shortcode to echo the relevant posts into a div: $categories = get_categories(); foreach ($categories as $category) { echo ‘<div>’; $cat=$category->cat_name; echo do_shortcode( ‘[catlist id=’.$cat.’ numberposts=5 ]’); echo ‘</div>’; } This goes in the ‘latest posts’ part of your … Read more

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