Optimizing or rewriting core queries

You could certainly write a wrapper function that implements caching of the WooCommerce core functionality, but WooCommerce isn’t going to use your wrapper function, so pretty pointless. Your best option is to create and use your own data store for WooCommerce that extends the WC_Data_Store_WP class, and add caching to those functions.

posts_per_page showing 16 elements instead of 3

Your query might be picking up sticky posts. To ignore them, try this: $args = array( ‘meta_query’ => array( array( ‘key’ => ‘featured_posts’, ‘compare’ => ‘==’, ‘value’ => ‘0’ ) ), ‘post_type’ => ‘post’, // Changed ‘3’ to 3, since WP_Query expects an int. ‘posts_per_page’ => 3, // Ignore the sticky posts. ‘ignore_sticky_posts’ => true, … Read more