How to figure out correct wp_options to have autoload=’yes’

WP-Rocket was deactivated, but the wp-content/object-cache.php file was still present. This file redefined the wp_cache_add in such a way that the method didn’t work, so all requests to get a single option value were resulting in a query to the wp_options table. I deleted the wp-content/object-cache.php file and the page response time dropped to 2 … Read more

Ascending & descending posts on same page with IF statement

You can’t change the DESC to ASC “within the IF statement”. The query has already ran at that point. I don’t really understand what the code is meant to do though. I don’t really see that code ever producing the pattern you describe. Specifically, I don’t understand what the shortcode strings or for or how … Read more

Admin Post List table Query filtering “WHERE” for custom post type

Awesome. This works! Thanks @Milo /*Change results based on the current user’s role and status */ function posts_for_current_role($query) { global $pagenow; if( ‘edit.php’ != $pagenow || !$query->is_admin ) return $query; if( current_user_can(‘editor’)): //Add query where clause to status equals “working”. $query->set( ‘post_status’, array( ‘working’, ‘draft’ ) ); endif; if( current_user_can(‘administrator’)): $query->set( ‘post_status’, array( ‘published’) ); … Read more

update $wpdb one query

Try removing the $wpdb->prepare. $wpdb->query(“UPDATE wp_postmeta SET meta_value = meta_value – 1 WHERE post_id= 9999 AND meta_key = ‘point_user'”);