Home / Disable / PPMX Security Essentials [PUSH]
Duplicate Snippet

Embed Snippet on Your Site

PPMX Security Essentials [PUSH]

Reinhard Ekker
<10
Code Preview
php
<?php
/* Wordpress Sitemap deaktivieren BEGIN */
add_filter( 'wp_sitemaps_enabled', '__return_false' );
/* Wordpress Sitemap deaktivieren END */
/* Wordpress Autoupdates deaktivieren BEGIN */
if ( ! defined( 'AUTOMATIC_UPDATER_DISABLED' ) ) {
	define( 'AUTOMATIC_UPDATER_DISABLED', true );
}
/* Wordpress Autoupdates deaktivieren END */
/* XML-RPC deaktivieren BEGIN */
add_filter( 'xmlrpc_enabled', '__return_false' );
/* XML-RPC deaktivieren END */
/* Meta Generator Tag entfernen BEGIN */
add_filter( 'the_generator', '__return_empty_string' );
/* Meta Generator Tag entfernen END */
/* Core Auto-Updates deaktivieren BEGIN */
add_filter( 'auto_update_core', '__return_false' );
/* Core Auto-Updates deaktivieren END */
/* Plugin Auto-Updates deaktivieren BEGIN */
add_filter( 'auto_update_plugin', '__return_false' );
/* Plugin Auto-Updates deaktivieren END */
/* Theme Auto-Updates deaktivieren BEGIN */
add_filter( 'auto_update_theme', '__return_false' );
/* Theme Auto-Updates deaktivieren END */
/* Anhang-Seiten Weiterleitung BEGIN */
add_action(
    'template_redirect',
    function () {
        global $post;
        if ( ! is_attachment() || ! isset( $post->post_parent ) || ! is_numeric( $post->post_parent ) ) {
            return;
        }
        // Attachment hat ein Parent-Post
        // Falls der Parent im Papierkorb ist, leite zur Startseite weiter
        if ( 0 !== $post->post_parent && 'trash' !== get_post_status( $post->post_parent ) ) {
            // Weiterleitung zum Parent-Post
            wp_safe_redirect( get_permalink( $post->post_parent ), 301 );
        } else {
            // Weiterleitung zur Startseite
            wp_safe_redirect( get_bloginfo( 'wpurl' ), 302 );
        }
        exit;
    },
    1
);
/* Anhang-Seiten Weiterleitung END */
/* Kommentare vollständig deaktivieren BEGIN */
add_action('admin_init', function () {
    global $pagenow;
    // Kommentare-Seite im Backend weiterleiten
    if ($pagenow === 'edit-comments.php') {
        wp_safe_redirect(admin_url());
        exit;
    }
    // Kommentare-Metabox im Dashboard entfernen
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
    // Kommentare und Trackbacks für alle Post-Types deaktivieren
    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');
        }
    }
});
// Kommentare und Pings auf der Website deaktivieren
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
// Existierende Kommentare im Frontend ausblenden
add_filter('comments_array', '__return_empty_array', 10, 2);
// Kommentare-Seite aus dem Admin-Menü entfernen
add_action('admin_menu', function () {
    remove_menu_page('edit-comments.php');
});
// Kommentare-Link aus der Admin-Bar entfernen
add_action('admin_bar_menu', function () {
    if (is_admin_bar_showing()) {
        remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
    }
});
/* Kommentare vollständig deaktivieren END */
// Archiv-Seiten deaktivieren 
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">';
    }
});
// Archiv-Seiten deaktivieren END
// YOOTHEME EDITOR PERMISSIONS
function hide_menu() {
 	$user = wp_get_current_user();
	
	// Check if the current user is an Editor
	if ( in_array( 'editor', (array) $user->roles ) ) {
		
		// They're an editor, so grant the edit_theme_options capability if they don't have it
		if ( ! current_user_can( 'edit_theme_options' ) ) {
			$role_object = get_role( 'editor' );
			$role_object->add_cap( 'edit_theme_options' );
		}
		
		// Hide the Themes page
	    remove_submenu_page( 'themes.php', 'themes.php' );
 
	    // Hide the Widgets page
	    remove_submenu_page( 'themes.php', 'widgets.php' );
	    // Hide the Customize page
	    //remove_submenu_page( 'themes.php', 'customize.php' );
 
	    // Remove Customize from the Appearance submenu
	    global $submenu;
	    unset($submenu['themes.php'][6]);
		
		//Remove YooTheme from main menu
		remove_menu_page('admin-ajax.php?action=kernel&p=customizer');
	}
}
 
add_action('admin_menu', 'hide_menu', 10);
add_action( 'admin_init','hide_menu', 999);
// YOOTHEME EDITOR PERMISSIONS END
//DISABLE WP ROCKET LAZY RENDERING
add_filter( 'rocket_lrc_optimization', '__return_false' , 999);

Comments

Add a Comment