From cfa1f93d5b9bc74dd963fc7a508a72dba1cb0318 Mon Sep 17 00:00:00 2001 From: argoexpert press Date: Fri, 6 Sep 2024 10:56:22 +0300 Subject: [PATCH] delete calendar events --- functions.php | 17 +++++++++++++++++ header.php | 1 + widgets/upcoming-events-widget-template.php | 2 -- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/functions.php b/functions.php index 8f82070..af6a856 100644 --- a/functions.php +++ b/functions.php @@ -14,6 +14,23 @@ add_filter( 'xmlrpc_methods', function( $methods ) { add_filter('rest_enabled', '__return_false'); add_filter('rest_jsonp_enabled', '__return_false'); +function redirect_non_admin_users() { + // Получаем текущего пользователя + $current_user = wp_get_current_user(); + + // Проверяем, если пользователь не является администратором + if (in_array('subscriber', $current_user->roles) || in_array('author', $current_user->roles)) { + // Если это запрос к административной панели или если пользователь пытается получить доступ к wp-admin + if (is_admin()) { + // Перенаправляем на главную страницу сайта + wp_redirect(home_url()); + exit; + } + } +} +add_action('admin_init', 'redirect_non_admin_users'); + + define('ENPART', 740); define('EN_PARTS', '746,741,742,743,744,745'); diff --git a/header.php b/header.php index 90b00c3..79202fd 100644 --- a/header.php +++ b/header.php @@ -13,6 +13,7 @@ +