off api
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
<?php
|
||||
setlocale(LC_TIME, 'ru_RU.UTF-8');
|
||||
|
||||
// Полностью отключить XML-RPC
|
||||
add_filter( 'xmlrpc_enabled', '__return_false' );
|
||||
|
||||
// Отключение методов XML-RPC, требующих авторизации
|
||||
add_filter( 'xmlrpc_methods', function( $methods ) {
|
||||
unset( $methods['pingback.ping'] );
|
||||
return $methods;
|
||||
} );
|
||||
|
||||
// Полное отключение REST API
|
||||
add_filter('rest_enabled', '__return_false');
|
||||
add_filter('rest_jsonp_enabled', '__return_false');
|
||||
|
||||
|
||||
define('ENPART', 740);
|
||||
define('EN_PARTS', '746,741,742,743,744,745');
|
||||
@@ -1145,3 +1158,15 @@ function change_author_name($author) {
|
||||
}
|
||||
add_filter('the_author', 'change_author_name');
|
||||
|
||||
// подписчики на главную
|
||||
add_action('admin_init', 'restrict_subscriber_admin_access');
|
||||
function restrict_subscriber_admin_access() {
|
||||
// Проверяем, что пользователь вошел в систему и имеет роль 'subscriber'
|
||||
if (current_user_can('subscriber')) {
|
||||
// Перенаправляем на главную страницу сайта
|
||||
wp_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user