add_action( 'admin_menu', function () { remove_submenu_page( 'plugins.php', 'plugin-install.php' ); }, 999 ); add_action( 'admin_init', function () { global $pagenow; if ( 'plugin-install.php' === $pagenow && ! wp_doing_ajax() ) { wp_die( 'Installing new plugins is disabled on this website.', 'Plugin Installation Disabled', array( 'response' => 403 ) ); } } ); /** * Prevent user creation through WordPress admin. */ add_action('admin_init', function () { if ( isset($_GET['page']) && $_GET['page'] === 'add-new-user' ) { wp_die( 'User creation is disabled on this website.', 'Access Restricted', array('response' => 403) ); } global $pagenow; if ($pagenow === 'user-new.php') { wp_die( 'User creation is disabled on this website.', 'Access Restricted', array('response' => 403) ); } });