-
Home
-
Royal Links
- Tips
How to Hide Royal Links Admin Menus
function plt_hide_royal_links_menus() {
//Hide "Royal Links".
remove_menu_page('edit.php?post_type=royal_link');
//Hide "Royal Links → All Links".
remove_submenu_page('edit.php?post_type=royal_link', 'edit.php?post_type=royal_link');
//Hide "Royal Links → Add New Link".
remove_submenu_page('edit.php?post_type=royal_link', 'post-new.php?post_type=royal_link');
//Hide "Royal Links → Categories".
remove_submenu_page('edit.php?post_type=royal_link', 'edit-tags.php?taxonomy=royal_link_category&post_type=royal_link');
//Hide "Royal Links → Tags".
remove_submenu_page('edit.php?post_type=royal_link', 'edit-tags.php?taxonomy=royal_link_tag&post_type=royal_link');
//Hide "Royal Links → Analytics".
remove_submenu_page('edit.php?post_type=royal_link', 'royal-links-analytics');
//Hide "Royal Links → Import/Export".
remove_submenu_page('edit.php?post_type=royal_link', 'royal-links-import-export');
//Hide "Royal Links → Link Health".
remove_submenu_page('edit.php?post_type=royal_link', 'royal-links-health');
//Hide "Royal Links → Split Tests".
remove_submenu_page('edit.php?post_type=royal_link', 'royal-links-split-tests');
//Hide "Royal Links → Settings".
remove_submenu_page('edit.php?post_type=royal_link', 'royal-links-settings');
}
add_action('admin_menu', 'plt_hide_royal_links_menus', 11);
Where do I put this code?
How to Hide Royal Links Meta Boxes
function plt_hide_royal_links_metaboxes() {
$screen = get_current_screen();
if ( !$screen ) {
return;
}
//Hide the "Link Settings" meta box.
remove_meta_box('royal_links_settings', $screen->id, 'normal');
//Hide the "Geo-Targeting" meta box.
remove_meta_box('royal_links_geo_targeting', $screen->id, 'normal');
//Hide the "A/B Split Testing" meta box.
remove_meta_box('royal_links_split_testing', $screen->id, 'normal');
//Hide the "Advanced Redirects" meta box.
remove_meta_box('royal_links_advanced_redirects', $screen->id, 'normal');
//Hide the "UTM Parameters" meta box.
remove_meta_box('royal_links_utm', $screen->id, 'normal');
//Hide the "Product Display" meta box.
remove_meta_box('royal_links_product', $screen->id, 'normal');
//Hide the "Link Options" meta box.
remove_meta_box('royal_links_options', $screen->id, 'side');
//Hide the "Link Statistics" meta box.
remove_meta_box('royal_links_stats', $screen->id, 'side');
//Hide the "Auto-Linking" meta box.
remove_meta_box('royal_links_auto_link', $screen->id, 'side');
//Hide the "QR Code" meta box.
remove_meta_box('royal_links_qr_code', $screen->id, 'side');
//Hide the "Short URL" meta box.
remove_meta_box('royal_links_short_url', $screen->id, 'side');
}
add_action('add_meta_boxes', 'plt_hide_royal_links_metaboxes', 20);
How to Hide the "Royal Links — Overview" Dashboard Widget
function plt_hide_royal_links_dashboard_widgets() {
$screen = get_current_screen();
if ( !$screen ) {
return;
}
//Remove the "Royal Links — Overview" widget.
remove_meta_box('royal_links_dashboard_widget', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'plt_hide_royal_links_dashboard_widgets', 20);