Merge pull request #13792 from woocommerce/fix-13763

Update notice to protect against calls before post type registration
This commit is contained in:
Mike Jolley 2017-03-28 13:32:52 +01:00 committed by GitHub
commit 4edcdd0fb1
2 changed files with 4 additions and 2 deletions

View File

@ -449,6 +449,8 @@ class WC_Post_types {
)
)
);
do_action( 'woocommerce_after_register_post_type' );
}
/**

View File

@ -93,8 +93,8 @@ function wc_get_orders( $args ) {
* @return WC_Order|WC_Refund
*/
function wc_get_order( $the_order = false ) {
if ( ! did_action( 'woocommerce_init' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'wc_get_order should not be called before the woocommerce_init action.', 'woocommerce' ), '2.5' );
if ( ! did_action( 'woocommerce_after_register_post_type' ) ) {
wc_doing_it_wrong( __FUNCTION__, __( 'wc_get_order should not be called before post types are registered (woocommerce_after_register_post_type action).', 'woocommerce' ), '2.5' );
return false;
}
return WC()->order_factory->get_order( $the_order );