WordPress 5.0.2 breaks WooCommerce admin order page – NO ORDERS FOUND – fix below

Last night another WordPress version 5.0.2 was released and being a maintenance release sites across the world that are already on WordPress 5.0.0 or 5.0.1 will auto update

So on clicking WooCommerce > Orders it says

No Orders Found

Not the words any shop owner ever wants to hear!!

Basically 5.0.2 has a bug that breaks the orders page within your woocommerce store! It’s not a major break – it won’t stop people ordering and you can still see your orders by clicking the mini menu above. Just click PENDING, PROCESSING, COMPLETED orders as per normal and up will display the orders new and old!

However this isn’t something that you want to leave like this and certainly you don’t want to panic your clients who have woocommerce stores.

Until another release is released to fix this – please insert these lines into your functions.php theme file


function fix_request_query_args_for_woocommerce( $query_args ) {
if ( isset( $query_args['post_status'] ) && empty( $query_args['post_status'] ) ) {
unset( $query_args['post_status'] );
}
return $query_args;
}
add_filter( 'request', 'fix_request_query_args_for_woocommerce', 1, 1 );

Much thanks goes to this post for posting this resolution