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.
Returns
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 10.5.0
private function is_accessing_settings() {
if ( is_admin() ) {
if ( ! is_wc_admin_settings_page() ) {
return false;
}
// phpcs:disable WordPress.Security.NonceVerification
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;
}