| |
| <?php
|
|
|
| add_filter( 'wp_sitemaps_enabled', '__return_false' );
|
|
|
|
|
| if ( ! defined( 'AUTOMATIC_UPDATER_DISABLED' ) ) {
|
| define( 'AUTOMATIC_UPDATER_DISABLED', true );
|
| }
|
|
|
|
|
| add_filter( 'xmlrpc_enabled', '__return_false' );
|
|
|
|
|
| add_filter( 'the_generator', '__return_empty_string' );
|
|
|
|
|
| add_filter( 'auto_update_core', '__return_false' );
|
|
|
|
|
| add_filter( 'auto_update_plugin', '__return_false' );
|
|
|
|
|
| add_filter( 'auto_update_theme', '__return_false' );
|
|
|
|
|
| add_action(
|
| 'template_redirect',
|
| function () {
|
| global $post;
|
| if ( ! is_attachment() || ! isset( $post->post_parent ) || ! is_numeric( $post->post_parent ) ) {
|
| return;
|
| }
|
|
|
|
|
| if ( 0 !== $post->post_parent && 'trash' !== get_post_status( $post->post_parent ) ) {
|
|
|
| wp_safe_redirect( get_permalink( $post->post_parent ), 301 );
|
| } else {
|
|
|
| wp_safe_redirect( get_bloginfo( 'wpurl' ), 302 );
|
| }
|
| exit;
|
| },
|
| 1
|
| );
|
|
|
|
|
| add_action('admin_init', function () {
|
| global $pagenow;
|
|
|
| if ($pagenow === 'edit-comments.php') {
|
| wp_safe_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('admin_bar_menu', function () {
|
| if (is_admin_bar_showing()) {
|
| remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
|
| }
|
| });
|
|
|
|
|
| add_action('template_redirect', function() {
|
| if (is_category() || is_tag() || is_author() || is_date()) {
|
| global $wp_query;
|
| $wp_query->set_404();
|
| status_header(404);
|
| nocache_headers();
|
| include( get_query_template( '404' ) );
|
| exit;
|
| }
|
| });
|
| add_action('wp_head', function() {
|
| if (is_category() || is_tag() || is_author() || is_date()) {
|
| echo '<meta name="robots" content="noindex, follow">';
|
| }
|
| });
|
|
|
|
|
| function hide_menu() {
|
| $user = wp_get_current_user();
|
|
|
|
|
| if ( in_array( 'editor', (array) $user->roles ) ) {
|
|
|
|
|
| if ( ! current_user_can( 'edit_theme_options' ) ) {
|
| $role_object = get_role( 'editor' );
|
| $role_object->add_cap( 'edit_theme_options' );
|
| }
|
|
|
|
|
| remove_submenu_page( 'themes.php', 'themes.php' );
|
|
|
|
|
| remove_submenu_page( 'themes.php', 'widgets.php' );
|
|
|
|
|
|
|
|
|
|
|
| global $submenu;
|
| unset($submenu['themes.php'][6]);
|
|
|
|
|
| remove_menu_page('admin-ajax.php?action=kernel&p=customizer');
|
| }
|
| }
|
|
|
| add_action('admin_menu', 'hide_menu', 10);
|
| add_action( 'admin_init','hide_menu', 999);
|
|
|
|
|
|
|
| add_filter( 'rocket_lrc_optimization', '__return_false' , 999);
|
| |
| |
Comments