woocommerce_routes_wc_payment_settings_intercept_render()
Intercept admin_init to render the page early. This bypasses the default WordPress admin template.
Хуков нет.
Возвращает
null. Ничего (null).
Использование
woocommerce_routes_wc_payment_settings_intercept_render();
Код woocommerce_routes_wc_payment_settings_intercept_render() woocommerce routes wc payment settings intercept render WC 11.3.0
function woocommerce_routes_wc_payment_settings_intercept_render() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( isset( $_GET['page'] ) && 'wc-payment-settings' === $_GET['page'] ) {
// The page renders outside the menu page callback flow, so it must
// enforce authentication and capability checks itself. Without this,
// any admin entry point firing `admin_init` (such as admin-post.php,
// which serves logged-out requests) would render the page for
// unauthenticated visitors.
if ( ! is_user_logged_in() ) {
auth_redirect();
}
if ( ! current_user_can( 'manage_woocommerce' ) ) {
wp_die(
__( 'Sorry, you are not allowed to access this page.' ),
403
);
}
woocommerce_routes_wc_payment_settings_render_page();
exit;
}
}