Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

1

You could use the wp_get_nav_menu_items filter add_filter('wp_get_nav_menu_items', 'prefix_add_categories_to_menu', 10, 3); Then you could do something like this: function prefix_add_categories_to_menu($items, $menu, $args) { // Make sure we only run the code on the applicable menu if($menu->slug !== 'replace_this' || is_admin()) return $items; ...


1

A more standard way to enqueue stylesheets in WP admin is to use wp_enqueue_style function on admin_enqueue_scripts hook. if I do any changes afterwards it doesnt update This sounds like a browser cache isssue. You can bust the cache by adding a dynamic version number parameter to the stylesheet url with the native php function filemtime. It returns the ...


1

This plugin provides filter to manage the menu item by meta value: function custom_menu_item_visibility( $visible, $item ){ if( isset( $item->roles ) ){ $user_id = get_current_user_id(); $user_meta = get_user_meta( $user_id, 'your-meta-key', true ); if ( /* your condition */ ){ $visible = true; } ...


1

To enable menu item based on user role you can try this plugin: https://wordpress.org/plugins/nav-menu-roles/


1

Based on "Remove Pagination in Appearance -> Menus -> Categories" answer thread for WordPress categories, you will adapt the answer code to WooCommerce Product Categories. The taxonomy of WooCommerce Product category is product_cat. Is also better to target admin nav menus only. Try the following (untested): add_filter( 'get_terms_args', '...


Only top voted, non community-wiki answers of a minimum length are eligible