$wpdb select all meta for each post

This is really simple. get_post_meta($postid); This will return all values in about the same syntax. In a more workable loop: <?php $custom = new WP_Query(array(“posts_per_page” => -1)) if( $custom->have_posts() ) { while ( $custom->have_posts() ) { the_post(); $data = get_post_meta(get_the_ID()); } } else { /* No posts found */ } ?>

mySQL statment count of post in each category and sub category

You may try this amateur code. SELECT COUNT(ID) FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (1) ) AND wp_posts.post_type=”post” AND ((wp_posts.post_status=”publish”)) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC Note the term_taxonomy_id IN (1) is where your category ID is 1. You may remove the line for published … Read more

#1115 – Unknown character set: ‘utf8mb4’

WordPress does not support MySQL 4 : To run WordPress your host just needs a couple of things: MySQL version 5.0 or greater (recommended: MySQL 5.5 or greater) https://wordpress.org/about/requirements/ While the utf8mb4 encoding is recent change and you might work around it, overall you still need compatible MySQL version.