i want to hide wp menu from my admin dashboard..
how remove/hide wordpress menu from admin dashboard .. i was try many code seems not work
I want to hide wpchtmlp_page menu item s. How to remove wpchtmlp_page menu item in admin page?
add_action('admin_menu', 'remove_admin_menu_items', 9999);
remove_menu_page( 'edit.php?post_type=wpchtmlp_page' );
You don't appear to be adding an actual function to the admin_menu hook. With the code you provided, it looks like you're adding a (potentially non-existent?) function to the admin_menu hook, and calling remove_menu_page without being on a hook, so it's firing way before the page is actually added.
add_action( 'admin_menu', 'so_59866103_remove_menu_items', 999 );
function so_59866103_remove_menu_items(){
remove_menu_page( 'edit.php?post_type=wpchtmlp_page' );
}
Generally speaking, you can also use a hook that runs later and before rendering (such as admin_init), which can be especially useful if that menu item was added in an unorthodox way.
add_action( 'admin_init', 'so_59866103_remove_menu_items', 999 );
function so_59866103_remove_menu_items(){
remove_menu_page( 'edit.php?post_type=wpchtmlp_page' );
}
You can remove menu from admin dashboard. Also you can remove any submenu as well. follow the sample code
function remove_item_from_menu() {
remove_menu_page( 'edit.php?post_type=elementor_library' ); // removes elementor addons , menu item added by plugins
remove_menu_page( 'edit-comments.php' ); // removes comment menu
remove_submenu_page('themes.php', 'theme-editor.php'); // remove submenu called theme edititor inside appearance
remove_submenu_page('themes.php', 'widgets.php'); // removes widgets submenu
}
add_action( 'admin_init', 'remove_item_from_menu' );
Related
In woocommerce product page, i would like remove the related product on the product bottom page and put it on sidebar.
I can remove it (on the bottom) with:
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
and add it in sidebar a widget [related_products]. But if I do it like this, I remove all related product.
Have you got an idea, how I could do it?
It just change the location of the related products… Here are the steps:
1) add the following code in your active child theme function.php file (only):
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products',20);
2) In backend settings "Appearance" > Widgets:
Add a Text widget to your product sidebar
Edit and paste inside the text editor the shortcode [related_products per_page="3" columns="1"]
Save.
Then you will get something like:
I think it may help you.
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);
First of all, you will remove the "woocommerce_after_single_product_summary" and overwrite like below.
add_action( 'woocommerce_before_single_product_summary', 'your_function', 25);
function your_function(){
...
...
}
Note: If you alter/modify the above hook it will affect in product single page.
After call related products in widgets via shortcode
I want to hide/delete the update notification of WordPress v4.9.1 from administration panel.
You can add this to your functions.php.
function hide_update_nag_admin()
{
if (current_user_can('update_core')) {
remove_action( 'admin_notices', 'update_nag', 3 );
}
}
add_action( 'admin_notices', 'hide_update_nag_admin', 1 );
The function checks to see if the current user has permission to update the core, if they do, then remove the update nag from the admin. We then add the hook into the admin_notices function.
Here's some reading about admin_notices:
https://digwp.com/2016/05/wordpress-admin-notices/
And a similar question:
https://wordpress.stackexchange.com/questions/231010/remove-update-nags-for-non-admins
And a plugin to do it:
https://wordpress.org/plugins/no-update-nag/
I have a wordpress website with learnpress plugin installed. We have tried all the available user role management plugins to remove admin menu items for a specific role and have managed to remove most of the ones we wanted with plugin "adminimize". However, this plugin does was not able to remove two unwanted admin menu items pointed out in this image http://i.imgur.com/gi5qT2d.jpg
We also tried some functions.php codes to remove menu items but are still not able to find solution. Can someone propose a solution? Thank you.
Have you tried something like this in functions.php in your theme ?
add_action( 'admin_init', 'my_remove_menu_pages' );function my_remove_menu_pages() {
global $user_ID;
if ( current_user_can( 'author' ) ) {
remove_menu_page( 'edit.php' );
remove_menu_page( 'path visible when you hover on the menu' );
remove_menu_page( 'edit.php?post_type=news' ); /*for custom post type*/
}}
I'm trying to hide breadcrumbs with a child theme of storefront. This is the code I have in functions.php however, the conditional does not fire when on the cart page. Removing the conditional causes the breadcrumbs to be hidden
add_action('init', 'remove_shop_breadcrumbs' );
function remove_shop_breadcrumbs()
{
if ( is_cart())
{
remove_action( 'storefront_content_top', 'woocommerce_breadcrumb', 10 );
}
}
From everything I can read, this is correct, does storefront replace this conditional with its own code, hence causing this to fail?
You're code is firing too early. The init hook is triggered before the queries have been run therefore is_cart() won't work. Use the wp action instead.
Change this:
add_action('init', 'remove_shop_breadcrumbs' );
To this:
add_action( 'wp', 'remove_shop_breadcrumbs' );
Is it possible to get activate plugin list in wordpress and remove it from admin menu bar ?. i want to remove all activate plugin links from adminu bar .
Findout the page and replace your_plugin_page .
<?php
function remove_menus(){
remove_menu_page( 'your_plugin_page.php' ); //probably where the plugin settings are available
}
add_action( 'admin_menu', 'remove_menus' );
?>
This will list out all activated plugins:-
$apl=get_option('active_plugins');
$plugins=get_plugins();
$activated_plugins=array();
foreach ($apl as $p){
if(isset($plugins[$p])){
array_push($activated_plugins, $plugins[$p]);
}
}
now you need to get all the pages .Not a perfect solution , but I hope it will be helpful.