| Server IP : 185.252.147.100 / Your IP : 216.73.217.33 Web Server : nginx/1.27.3 System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : mitr ( 1000) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/html/metal.mitrofanov.ru/wordpress/wp-content/themes/generatepress_child/inc/ |
Upload File : |
<?php
defined('ABSPATH') || exit;
//stop heartbeat
add_action('init', function () {
wp_deregister_script('heartbeat');
}, 1);
remove_action('admin_enqueue_scripts', 'wp_auth_check_load');
add_action('admin_init', function () {
wp_deregister_script('autosave');
});
//Отключаем тесты!
add_filter('site_status_tests', function ($tests) {
unset($tests[ 'async' ][ 'dotorg_communication' ]);
unset($tests[ 'async' ][ 'background_updates' ]);
unset($tests[ 'async' ][ 'loopback_requests' ]);
unset($tests[ 'direct' ][ 'rest_availability' ]);
return $tests;
});
// Removes RSD, XMLRPC, WLW, WP Generator,
// ShortLink and Comment Feed links
add_filter('xmlrpc_enabled', '__return_false');
add_action('after_setup_theme', function () {
remove_action('wp_head', 'feed_links_extra', 3);
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action('wp_head', 'rest_output_link_wp_head', 10);
});
// Disable the emoji's
add_action('init', function () {
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_styles', 'print_emoji_styles');
});
// Disable REST to not admin
add_filter('rest_authentication_errors', function ($result) {
if (is_null($result) && ! current_user_can('edit_others_posts')) {
return new WP_Error('rest_forbidden', 'Rest was disabled forever.', [ 'status' => 401 ]);
}
return $result;
});
//Comments Disable
add_action('admin_init', function () {
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
foreach (get_post_types() as $post_type) {
if (post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
}
});
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
add_filter('comments_array', '__return_empty_array', 10, 2);
add_action('admin_menu', function () {
remove_menu_page('edit-comments.php');
});
add_action('init', function () {
if (is_admin_bar_showing()) {
remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
}
});
// Restrict access to the administration screens.
add_action('admin_init', function () {
if (! current_user_can('manage_options') && (! wp_doing_ajax())) {
//wp_safe_redirect( 'https://lekarvostoka.ru' ); // Replace this with the URL to redirect to.
wp_safe_redirect(home_url('/'));
exit;
}
}, 1);
// Disable author page
add_action('wp', function () {
global $wp_query;
if ($wp_query->is_author) {
wp_safe_redirect(get_bloginfo('url'), 301);
exit;
}
});
// Disable Self Pingback
add_action('pre_ping', function (&$links) {
foreach ($links as $l => $link) {
if (0 === strpos($link, get_option('home'))) {
unset($links[ $l ]);
}
}
});