-
Home
-
Shortcodes for Amazon Affiliate
- Tips
How to Hide Affiliate Shortcodes for Amazon Admin Menus
function plt_hide_affiliate_shortcodes_for_amazon_menus() {
//Hide "AMZ Shortcodes".
remove_menu_page('edit.php?post_type=amz_product');
//Hide "AMZ Shortcodes → All Products".
remove_submenu_page('edit.php?post_type=amz_product', 'edit.php?post_type=amz_product');
//Hide "AMZ Shortcodes → Add Product".
remove_submenu_page('edit.php?post_type=amz_product', 'post-new.php?post_type=amz_product');
//Hide "AMZ Shortcodes → Shortcodes".
remove_submenu_page('edit.php?post_type=amz_product', 'edit-tags.php?taxonomy=amazon_shortcode&post_type=amz_product');
//Hide "AMZ Shortcodes → Settings".
remove_submenu_page('edit.php?post_type=amz_product', 'amz_shortcodes_settings');
}
add_action('admin_menu', 'plt_hide_affiliate_shortcodes_for_amazon_menus', 11);
Where do I put this code?
How to Hide Affiliate Shortcodes for Amazon Meta Boxes
function plt_hide_affiliate_shortcodes_for_amazon_metaboxes() {
$screen = get_current_screen();
if ( !$screen ) {
return;
}
//Hide the "Product Price" meta box.
remove_meta_box('wpamz_box_price', $screen->id, 'advanced');
//Hide the "Product Link" meta box.
remove_meta_box('wpamz_box_affilink', $screen->id, 'advanced');
//Hide the "Product image URL" meta box.
remove_meta_box('wpamz_box_imgurl', $screen->id, 'advanced');
}
add_action('add_meta_boxes', 'plt_hide_affiliate_shortcodes_for_amazon_metaboxes', 20);