WooCommerce sort by SKU

To use with woocommerce plugin and theme already css and code. $args = array( ‘post_type’ => ‘product’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘_sku’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘DESC’, ); query_posts( $args ); if( have_posts() ) : while (have_posts()): the_post(); wc_get_template_part( ‘content’, ‘product’ ); endwhile; endif; wp_reset_query();

WordPress private post won’t display to other admins

The solution I found is in the pre_get_posts function: I added: if ( is_user_logged_in() ) { $query->set( ‘post_status’, array(‘private’, ‘publish’)); } Full code for function: /*——- START add webinars custom post type to the main query loop———-*/ add_filter(‘pre_get_posts’, ‘query_post_type’); function query_post_type($query) { if( is_category() ) { $post_type = get_query_var(‘post_type’); // show private posts to admins … Read more