off api
This commit is contained in:
@@ -4,6 +4,20 @@ if (! defined( 'ABSPATH' )) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Полностью отключить 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');
|
||||
|
||||
ini_set('display_errors','off');
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
@@ -1033,3 +1047,15 @@ function convert_images_to_amp($content) {
|
||||
}
|
||||
add_filter('the_content', 'convert_images_to_amp');
|
||||
|
||||
|
||||
// подписчики на главную
|
||||
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