Merge pull request #13792 from woocommerce/fix-13763
Update notice to protect against calls before post type registration
This commit is contained in:
commit
4edcdd0fb1
|
@ -449,6 +449,8 @@ class WC_Post_types {
|
|||
)
|
||||
)
|
||||
);
|
||||
|
||||
do_action( 'woocommerce_after_register_post_type' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue