From e44d0e60db77fd34538ce70aa8901637eae02f67 Mon Sep 17 00:00:00 2001 From: Tamara Zuk Date: Fri, 13 Feb 2015 15:08:15 -0500 Subject: [PATCH] Register shop_order post statuses earlier Registering the post statuses on `init` with a priority of 10 is too late for some uses. Particularly if you are using `WP_Query` on `init`, WP core will not add the `post_status` where clause if the custom post statuses are not registered yet. I ran into this issue on a site using `ALTERNATE_WP_CRON` which runs `wp_cron()` on `init` with a default priority of `10`. It appears that this may fix #7408 as well. --- includes/class-wc-post-types.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-post-types.php b/includes/class-wc-post-types.php index 3f83312287d..91d4411ddf6 100644 --- a/includes/class-wc-post-types.php +++ b/includes/class-wc-post-types.php @@ -26,7 +26,7 @@ class WC_Post_types { public static function init() { add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 5 ); add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 ); - add_action( 'init', array( __CLASS__, 'register_post_status' ), 10 ); + add_action( 'init', array( __CLASS__, 'register_post_status' ), 9 ); add_action( 'init', array( __CLASS__, 'support_jetpack_omnisearch' ) ); }