Tag Info

Hot answers tagged

4

Without looking at your box to see exactly what's going on, here are some potential avenues of slowness: Potential Causes Apache Apache is usually configured in such a way that a single httpd process is always running in the background. When a request comes in over the wire, it spins up a new httpd process to handle the request. Once the request closes, ...


2

Completely canceling main query is pretty much high level madness, that involves subclassing wp class. I would: Hook into pre_get_posts with is_main_query() check Run featured query (still inside hook) and stash results somewhere Use those results to set excluded posts on main query


2

This is essentially a SQL question. The only possible WordPress related component would be if you were asking about database structure, which is in the Codex. Or you could just look at the database itself. The post ID is incremented and never duplicated. The highest IDs are the last added. The query is simple. SELECT * FROM {$wpdb->posts} WHERE ...


1

While the WPDB class, or its global $wpdb instance are your friend when it comes to querying custom tables or WP core data that does not have a higher-level API, it is overkill to use it to query posts. Instead, read up on WP_Query. In your case, you'd use it like so: $args = array( 'posts_per_page' => 50, /* set limit to 50 */ 'post_type' ...


1

The wpdb object can be used to run arbitrary queries against the WordPress database. Let's say you want to list the most recent 4 posts: $results = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE `post_type`='post' LIMIT 4" ); The $wpdb->posts variable will output the table name for posts. It's usually wp_posts, but if you're using a ...


1

I have encountered the same kind of issue before, as you have already noted down the problem boiled down to mysql not accepting too many connections, The solution we implemented was to apply proper caching (check how often the cache is invalidated and other caching settings) and upgrade the mysql server. As a quick fix, you could flush the connections on ...



Only top voted, non community-wiki answers of a minimum length are eligible