Complicated MySQL Query
Why not just use WP_Query for this instead of inventing the wheel all over again? I’m pretty sure you can solve this with a meta query within your WP_Query. See the codex.
Why not just use WP_Query for this instead of inventing the wheel all over again? I’m pretty sure you can solve this with a meta query within your WP_Query. See the codex.
Fetching all tags of post: SELECT p.id, p.post_name, c.name, GROUP_CONCAT(t.`name`) as tag FROM wp_posts p JOIN wp_term_relationships cr on (p.`id`=cr.`object_id`) JOIN wp_term_taxonomy ct on (ct.`term_taxonomy_id`=cr.`term_taxonomy_id` and ct.`taxonomy`=’category’) JOIN wp_terms c on (ct.`term_id`=c.`term_id`) JOIN wp_term_relationships tr on (p.`id`=tr.`object_id`) JOIN wp_term_taxonomy tt on (tt.`term_taxonomy_id`=tr.`term_taxonomy_id` and tt.`taxonomy`=’post_tag’) JOIN wp_terms t on (tt.`term_id`=t.`term_id`) GROUP BY p.id order by p.id … Read more
I actually found the issue. It was in the foreach I found the issue where I had an unnecessary sql-query that i removed.
function delete_posts() { $lastposts = get_posts(array(‘numberposts’ => -1)); if ( $lastposts ) { foreach ( $lastposts as $post ) : setup_postdata( $post ); ?> <?php $content = get_the_content(); if (str_word_count($content) < 100) { wp_trash_post($post->ID); } ?> <?php endforeach; wp_reset_postdata(); }}add_action( ‘init’, ‘delete_posts’ );
Have you tried the search and replace plugin? it will allow you to select particular tables: http://wordpress.org/extend/plugins/search-and-replace/ Of course use it with caution. etc.
Dismissed pointers are stored as user meta, you can inspect this for yourself with: $meta = get_user_meta( wp_get_current_user() ); print_r( $meta[‘dismissed_wp_pointers’] ); In your case, the meta might be empty or damaged, to update dismissed pointers for ALL users on your blog, you could run this function (only once): function wpse80084_dismiss_wp_pointers() { $dismissed = array( … Read more
SELinux was contributing to the problem. The main issue was that an HTML page was attempting to talk to another port on the localhost. I would not have seen the problem if the HAProxy was running on a separate host. The log was revealed in /var/log/messages, where I should have checked but did not considering … Read more
Got it solved. Probably not the most efficient way but it works! SELECT product_id, meta_value FROM ( SELECT order_meta.order_item_id, order_meta.meta_value AS ‘product_id’ FROM wp_woocommerce_order_itemmeta AS order_meta LEFT JOIN wp_woocommerce_order_items AS order_items ON order_meta.order_item_id = order_items.order_item_id LEFT JOIN wp_term_relationships AS term_rels ON term_rels.object_id = order_items.order_id WHERE term_taxonomy_id = 24 AND order_meta.meta_key = ‘_product_id’ ) AS product_ID … Read more
Rather than mess around trying to find the serialised data that got messed up, just use a tool to migrate environments and avoid messing up serialised data. WP Migrate DB is a good one that handles serialised data properly. The free version does a great job, as long as you don’t have a huge database. … Read more
Backup your db Remeber to backup your db Import the backup in another database, change wp-config.php to use this new database and see if everithing is ok. (Importing is successfull? Site appear without any change?) WordPress uses a prefix for table names. The default is ‘wp_’ but clever guys change it with something else. (The … Read more