WC_Gateway_COD::is_accessing_settings()
Checks to see whether or not the admin settings are being accessed by the current request.
Method of the class: WC_Gateway_COD{}
No Hooks.
Return
true|false
.
Usage
// private - for code of main (parent) class only $result = $this->is_accessing_settings();
WC_Gateway_COD::is_accessing_settings() WC Gateway COD::is accessing settings code WC 9.7.1
private function is_accessing_settings() { if ( is_admin() ) { // phpcs:disable WordPress.Security.NonceVerification if ( ! isset( $_REQUEST['page'] ) || 'wc-settings' !== $_REQUEST['page'] ) { return false; } if ( ! isset( $_REQUEST['tab'] ) || 'checkout' !== $_REQUEST['tab'] ) { return false; } if ( ! isset( $_REQUEST['section'] ) || self::ID !== $_REQUEST['section'] ) { return false; } // phpcs:enable WordPress.Security.NonceVerification return true; } if ( Constants::is_true( 'REST_REQUEST' ) ) { global $wp; if ( isset( $wp->query_vars['rest_route'] ) && false !== strpos( $wp->query_vars['rest_route'], '/payment_gateways' ) ) { return true; } } return false; }