Tips on Customizing WordPress Popular Posts

How to Hide the "WordPress Popular Posts" Admin Menu

function plt_hide_wordpress_popular_posts_menus() {
	//Hide the "Settings → WordPress Popular Posts" menu.
	remove_submenu_page('options-general.php', 'wordpress-popular-posts');
}

add_action('admin_menu', 'plt_hide_wordpress_popular_posts_menus', 11);

Where do I put this code?

How to Hide the "Trending now" Dashboard Widget

function plt_hide_wordpress_popular_posts_dashboard_widgets() {
	$screen = get_current_screen();
	if ( !$screen ) {
		return;
	}

	//Remove the "Trending now" widget.
	remove_meta_box('wpp_trending_dashboard_widget', 'dashboard', 'normal');
}

add_action('wp_dashboard_setup', 'plt_hide_wordpress_popular_posts_dashboard_widgets', 20);