Archive for the ‘wordpress’ Category

Remove Comments in WordPress pages

To remove comments in the wordpress pages you have to comment you have to edit the file comments.php in the theme directory (the one you want to use).
You just need to add on the top of the file, as first line the following line:
<?php return false; ?>

That’s all.

WordPress: How to remove items in the administration dashboards

Yeah, you have understood that this blog is powered by WordPress.

Surfing the web, I have found plugins and posts about removing items from the wordpress dashboard.

Loggin as administrator, i’ve tried a plugin called: “remove-posts-from-admin”, but that doesn’t remove the comments.

I’ve tried some code modifications suggested by other bloggers, so I’ve found a way to make it.

Nobody tells it straight. So here it is :-). You have to modify a file in your theme folder:


To remove “posts” and “comments” simply add this code at the end of the file:



add_action( 'admin_menu', 'remove_links_menu' );
function remove_links_menu() {
remove_menu_page('index.php'); // Dashboard
// remove_menu_page('edit.php'); // Posts
// remove_menu_page('upload.php'); // Media
// remove_menu_page('link-manager.php'); // Links
// remove_menu_page('edit.php?post_type=page'); // Pages
remove_menu_page('edit-comments.php'); // Comments
// remove_menu_page('themes.php'); // Appearance
// remove_menu_page('plugins.php'); // Plugins
// remove_menu_page('users.php'); // Users
//remove_menu_page('tools.php'); // Tools
// remove_menu_page('options-general.php'); // Settings



Another way is the following. This is a core modification and may cause incompatibility problems if you want to upgrade. Anyway it works:

You simply need to edit the file called menu.php in the wp-admin directory.

I’ve commented the “posts” and “comments” sections and moved Pages to the top (changed the number in the array, $menu[5] is now Posts) :

$menu[5] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'div' );
$submenu['edit.php?post_type=page'][5] = array( __('All Pages'), 'edit_pages', 'edit.php?post_type=page' );
/* translators: add new page */
$submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), 'edit_pages', 'post-new.php?post_type=page' );
$i = 15;
foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
if ( ! $tax->show_ui || ! in_array('page', (array) $tax->object_type, true) )

$submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=page' );

$awaiting_mod = wp_count_comments();

$awaiting_mod = $awaiting_mod->moderated;

To remove a section you must comment the piece of code, adding /* at the beginning and */ at the end. Like this:

/*$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'div' );
$submenu['edit.php'][5] = array( __('All Posts'), 'edit_posts', 'edit.php' );
/* translators: add new post */ /*
$submenu['edit.php'][10] = array( _x('Add New', 'post'), 'edit_posts', 'post-new.php' );

$i = 15;
foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) )

$submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
unset($tax); */


/*$menu[25] = array( sprintf( __('Comments %s'), "" . number_format_i18n($awaiting_mod) . "" ), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'div' );

$submenu[ 'edit-comments.php' ][0] = array( __('All Comments'), 'edit_posts', 'edit-comments.php' );

$_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group

Easy, right?