Update a WordPress post or page takes 60+ seconds

There’s a plugin called Debug Bar which you can find at http://wordpress.org/plugins/debug-bar/ Don’t leave this enabled in production! But it will tattle on slow MySQL queries. You might also wish to try using WP Clean Up. http://wordpress.org/plugins/wp-clean-up/ This flushes out stale entries in your database, and does a little bit of table reorg/optimization.

How to migrate the posts from an old custom legacy blog to a new WordPress website?

Old unanswered question, but found this via the googles (1st answer) that appears to have good info / links (might be useful to someone): What is the required format for importing posts into WordPress? Plus this one from the Codex, which has info on importing from all sorts of formats, including RSS and XML. https://codex.wordpress.org/Importing_Content … Read more

Manually query posts by taxonomy with MySQL

This worked fine for me. The postmeta inclusion might be a bit messy. Without it, I got about 150 results. With it, I got over 5000. I never go an empty result. Since postmeta will have anywhere from zero to hundreds of items per post, it is going to make a new row for every … Read more

Converting mysql to $wpdb

You can query INFORMATION_SCHEMA and achieve the same: function getEnumValues($table, $field) { global $wpdb; $result = $wpdb->get_row(“SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ‘” . DB_NAME . “‘ AND TABLE_NAME = ‘” . $table . “‘ AND COLUMN_NAME LIKE ‘” . $field . “‘”); if($result === FALSE) { die($wpdb->last_error); } // this is the column … Read more

Calculating Bayesian average for custom post type

This is the (updated) code I’m using, which gives results like I’d expect: $args = array( ‘post_type’ => ‘entry’, ‘orderby’ => ‘bayesian_average’, ‘order’ => ‘DESC’, ‘post_status’ => ‘publish’ ); $loop = new WP_Query($args); $number_of_entrants = $loop->post_count; $total_ratings = $total_num_votes = 0; foreach ($loop->posts as $query_post) { $count = $query_post->ratings_count; $average = $query_post->ratings_average; $total_num_votes += $count; … Read more