Debugging WordPress

The basic technique of logging queries is that if SAVEQUERIES constant is defined to be true (it’s not by default for performance reasons) then $wpdb->queries will keep the log of queries performed. There isn’t anything on top of this that WordPress natively does. There are plenty of plugins around which work either by interpreting this … Read more

Auto-update tables from database

qwip, There is one way to update your custom table while wordpress users table in action and for that you require to code with custom function which is called while some action perform by user. You can handle it by add_action(). There are several action act by wordpress for user(viz. user_register, deleted_user, etc). See below … Read more

WP Optimization: Removing Orphaned wp_options (especially the autoload ones)

Do you have access to a SQL client program like phpmyadmin or something similar? If so give this query SELECT option_id, option_name, LENGTH(option_value) FROM wp_options WHERE autoload = ‘yes’ AND option_name NOT LIKE ‘_transient%’ ORDER BY 3 DESC LIMIT 20; You’ll see the top twenty auto loaded options in descending order of length. Eyeball the … Read more

Fetch all Posts where logged in user has commented

It should be simple since comments are stored with a user_id if they are created by a logged in user and if not then its set to false so all you need to do is select the post id from comments that are made by user_id bigger the zero, something like this: function get_posts_with_loogedin_user_comments(){ global … Read more