Loader::is_admin_page() throws fatal error if woocommerce_admin_disabled is true. (https://github.com/woocommerce/woocommerce-admin/pull/6563)

* Check for function before calling

* Add comment & changelog note

Co-authored-by: Lee Willis <lee@ademti-software.co.uk>
Co-authored-by: Adrian Duffell <9312929+adrianduffell@users.noreply.github.com>
This commit is contained in:
Lee Willis 2021-03-16 23:47:48 +00:00 committed by GitHub
parent 4ad0d142e4
commit c8e4714c71
2 changed files with 3 additions and 1 deletions

View File

@ -116,6 +116,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
- Dev: Store profiler - Added MailPoet to Business Details step #6503
- Dev: Store profiler - Added MailPoet to new Business Details step #6515
- Dev: Add tilde (~) to represent client root directory for imports. #6517
- Fix: Fix issue where Loader::is_admin_page() would error if WooCommerce admin is disabled. #6563
- Add: Add Ireland to Square payment method #6559
- Add: CES survey for search product, order, customer #6420
- Add: CES survey for importing products #6419

View File

@ -755,7 +755,8 @@ class Loader {
* Returns true if we are on a JS powered admin page.
*/
public static function is_admin_page() {
return wc_admin_is_registered_page();
// Check the function exists before calling in case WC Admin is disabled. See PR #6563.
return function_exists( 'wc_admin_is_registered_page' ) && wc_admin_is_registered_page();
}
/**