Last active
July 20, 2024 13:14
-
-
Save ianpegg/011dbee31391f0a049ba46bbbd623bb8 to your computer and use it in GitHub Desktop.
WordPress started as a blogging platform - but not every site needs a blog!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: EggMUP: Remove Blog from WordPress | |
* Plugin URI: https://gist.github.com/ianpegg/011dbee31391f0a049ba46bbbd623bb8 | |
* Description: WordPress started as a blogging platform - but | |
* not every site needs a blog! Note: at the moment, this MUP just hides | |
* post editing and creation in the dashboard as core post types cannot be disabled! | |
* Version: 1.0 | |
* Author: Ian Pegg | |
* Author URI: https://eggcupwebdesign.com | |
* php version 7.4.15 | |
* | |
* @category Must_Use_Plugin | |
* @package WordPress_Plugin | |
* @author Ian Pegg <[email protected]> | |
* @license GNU/GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
* @link https://eggcupwebdesign.com | |
*/ | |
namespace EggCup\MUP\RemoveBlog; | |
if (!defined('ABSPATH')) { | |
exit; | |
} | |
/** | |
* Removes all traces of the blog and post editing | |
* from the dashboard sidebar menu. | |
* | |
* @return void | |
*/ | |
add_action('admin_menu', function () | |
{ | |
remove_menu_page('edit.php'); | |
} | |
); | |
/** | |
* Removes all traces of the blog and post editing | |
* from the dashboard toolbar menu. | |
* | |
* @return void | |
*/ | |
add_action('wp_before_admin_bar_render', function () | |
{ | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu('new-post'); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment