Transient not behaving as expected

rule of thumb is probably to use transients for simple objects (strings integers, array) as the result of unserialization of objects might be surprising and side effect might happen unless the object is fully static. IIRC, when unserializing an object PHP will also run its default constructor, which in your case will do the query … Read more

How to search for posts given post_content AND post_excerpt using WP_Query?

The only solution I could find for this was to save my two values as post_meta, then use this code: $args = array( ‘post_type’ => ‘POST_TYPE_HERE’, ‘post_status’ => ‘active’, ‘update_post_term_cache’ => false, // don’t retrieve post terms ‘meta_query’ => array( ‘relation’ => ‘and’, array( ‘key’ => ‘META1_NAME’, ‘value’ => $order_id, ‘compare’ => ‘=’, ), array( … Read more

WP_Query and NULL meta keys

I do not believe there is a way to do both queries in one within WordPress. If the filters you have in place are working and aren’t injecting raw user input into the database query then what is the issue? that is exactly what the filters are there for. If you are uncomfortable using the … Read more

slow WP_Query for non-admin user

ok,so I digged into wp-includes/query.php,and found this on line 3180: if ( is_user_logged_in() ) { // Add private states that are limited to viewing by the author of a post or someone who has caps to read private states. $private_states = get_post_stati( array(‘private’ => true) ); foreach ( (array) $private_states as $state ) $where .= … Read more