Site Security & Optimization

// Disable Yoast SEO HTML Comments add_filter(‘wpseo_debug_markers’, ‘__return_false’); // Disable XML-RPC add_filter(‘xmlrpc_enabled’, ‘__return_false’); // Remove WordPress Version Number add_filter(‘the_generator’, ‘__return_empty_string’); // Disable Plugin & Theme Editor if (!defined(‘DISALLOW_FILE_EDIT’)) { define(‘DISALLOW_FILE_EDIT’, true); } // Disable Author Archives add_action(‘template_redirect’, function(){ global $wp_query;…Continue reading

Disable Gutenberg Styles

// disable gutenberg frontend styles @ https://m0n.co/15 function disable_gutenberg_wp_enqueue_scripts() { wp_dequeue_style(‘wp-block-library’); wp_dequeue_style(‘wp-block-library-theme’); wp_dequeue_style(‘global-styles’); wp_dequeue_style(‘classic-theme-styles’); } add_filter(‘wp_enqueue_scripts’, ‘disable_gutenberg_wp_enqueue_scripts’, 100);Continue reading

Disable Posts Post Type

// Remove side menu add_action( ‘admin_menu’, function () { remove_menu_page( ‘edit.php’ ); } ); // Remove +New post in top Admin Menu Bar add_action( ‘admin_bar_menu’, function ( $wp_admin_bar ) { $wp_admin_bar->remove_node( ‘new-post’ ); }, 999 ); // Remove Quick Draft…Continue reading

function – Disable Comments Completely

add_action(‘admin_init’, function () { // Redirect any user trying to access comments page global $pagenow; if ($pagenow === ‘edit-comments.php’) { wp_safe_redirect(admin_url()); exit; } // Remove comments metabox from dashboard remove_meta_box(‘dashboard_recent_comments’, ‘dashboard’, ‘normal’); // Disable support for comments and trackbacks in…Continue reading