WordPress – Block Settings | Permalinks menu option from Dashboard

When you change the Permalinks settings in WordPress, you effectively change the Apache mod_rewrite rule that rewrites URLs.

The .htaccess file auto-generated by WordPress does not always suit the server hosting the web site.

To prevent administrators from accessing the Permalinks menu option in the dashboard you can use the following code and create a ‘must-use’ (mu) WordPress plugin:

…/wp-content/mu-plugins/block-permalinks.php

<?php

add_action( 'admin_menu', 'tabcom_remove_menus' );

add_action( 'admin_init', 'tabcom_block_permalinks' );

function tabcom_remove_menus() {
    remove_submenu_page( 'options-general.php', 'options-permalink.php' );
}

function tabcom_block_permalinks() {
        global $pagenow;
        if ( 'options-permalink.php' == $pagenow ) {
                wp_die( 'Not allowed' );
        }
}

?>
WordPress – Block Settings | Permalinks menu option from Dashboard was last modified: August 17th, 2016 by tabcom