Skip to content

Commit

Permalink
remove comments from admin menu and bar
Browse files Browse the repository at this point in the history
  • Loading branch information
sksaju committed Mar 10, 2024
1 parent 0ed9e9a commit a6a0b55
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions includes/classes/AdminCustomizations/Customizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public function setup() {
add_action( 'admin_bar_menu', [ $this, 'add_about_menu' ], 11 );
add_action( 'admin_menu', [ $this, 'register_admin_pages' ] );
add_filter( 'admin_title', [ $this, 'admin_title_fix' ], 10, 2 );

// Remove comments-related UI elements
add_action( 'admin_menu', [ $this, 'remove_comments_admin_menus' ] );
add_action( 'wp_before_admin_bar_render', [ $this, 'remove_comments_admin_bar_links' ] );
}

/**
Expand Down Expand Up @@ -195,4 +199,23 @@ public function filter_admin_footer_text() {
$new_text = sprintf( __( 'Thank you for creating with <a href="https://wordpress.org">WordPress</a> and <a href="http://10up.com">10up</a>.', 'tenup' ) );
return $new_text;
}

/**
* Remove comments admin menus
*
* @return void
*/
public function remove_comments_admin_menus() {
remove_menu_page( 'edit-comments.php' );
}

/**
* Remove comments admin bar links
*
* @return void
*/
public function remove_comments_admin_bar_links() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu( 'comments' );
}
}

0 comments on commit a6a0b55

Please sign in to comment.