Merge pull request #23840 from unfulvio/23839-do-not-throw-notice-rest-api-includes

[#23839] Do not throw autoloader notice if following notice instructions
This commit is contained in:
Claudio Sanches 2019-06-18 15:51:22 -03:00 committed by GitHub
commit bf01eccfcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -91,7 +91,7 @@ class WC_Autoloader {
}
// Prevent plugins from breaking if they extend the rest API early.
if ( 0 === strpos( $class, 'wc_rest_' ) && ! did_action( 'rest_api_init' ) ) {
if ( 0 === strpos( $class, 'wc_rest_' ) && ! class_exists( $class, false ) && ! did_action( 'rest_api_init' ) ) {
wc_doing_it_wrong( $class, __( 'Classes that extend the WooCommerce/WordPress REST API should only be loaded during the rest_api_init action, or should call WC()->api->rest_api_includes() manually.', 'woocommerce' ), '3.6' );
WC()->api->rest_api_includes();
}