Add a sub menu page to the Users menu

Happy New year to all. Happy to answer about wordpress in New Year. Hi, You are trying to link an admin page in navigation menu. Admin page can’t be accessed without logging in. Also the url wp-admin/users.php?page=business&user_id=2 can be accessed by user with id 2. If you wanted to create new page then go to … Read more

How to get submenu of admin menu?

You can use the global variable $submenu. Example to list the child menu of parent post menu:- function admin_init_callback() { global $submenu; $sumenu_list = $submenu[‘edit.php’]; var_dump($sumenu_list); //array of submenu } add_action(‘admin_init’, ‘admin_init_callback’, 999); Profi660 EDIT: Not needed to be used with admin_init hook. I used this in my plugin page and worked very well.

Get parents child pages

Solved it, and decided I could best post my answer here, since people can learn from it 🙂 <?php global $post; $children = get_pages( array( ‘child_of’ => $post->ID ) ); $siblings = get_pages( array( ‘child_of’ => $post->post_parent ) ); // or, if you want to exclude the current page: // $siblings = get_pages( array( ‘child_of’ … Read more

How to use wp_nav_menu to create custom dropdown menu?

Use wp_nav_menu() with proper parameters to add the dropdown-menu forAnimate class, to remove the wrapper and to add the role attribute: <ul class=”nav navbar-nav”> <li class=”active”><a href=”https://wordpress.stackexchange.com/questions/255497/index.html”>Home</a></li> <li><a href=”category.html”>Category Page</a></li> <li><a href=”article.html”>Article Page</a></li> <li class=”dropdown”> <a href=”#” class=”dropdown-toggle” data-toggle=”dropdown”> Category Type A <span class=”caret”></span></a> <?php wp_nav_menu(array( ‘menu’ => ‘my_menu_name’, // specify the menu name ‘menu_class’ … Read more

sub-page settings saving in NETWORK DASHBOARD

The easiest thing to do is to set the form’s action=” and use the global $plugin_page; as described in the Notes section of add_submenu_page(). For example: add_action (‘network_admin_menu’, ‘add_network_menus’) ; function add_network_menus () { add_menu_page (‘My Page Title’, ‘My Menu Title’, ‘manage_network’, ‘my_menu_slug’, ‘my_network_admin_page’) ; add_submenu_page (‘my_menu_slug’, ‘Some Subpage Title’, ‘My Submeny Title’, ‘manage_network’, ‘my_submenu_slug’, … Read more

Make Home page current if there are sub-menus

Typical menu structure with ‘Home’ item being a Custom Link and other menu items being pages: The ‘Home’ menu item must not point to a real page and should look like that: The ‘Home’ menu item stays the same, regardless of the choice you’ve made in Settings -> Reading -> Front page displays. Remove the … Read more

Creating menu always gives error A name is required for this term

I got the same issue and found that the plugin user-activity-log was at the origin of the problem. As I reported here,the problem is related to the hooks: ual_shook_created_term ual_shook_edited_term ual_shook_delete_term They return nothing instead of the given term when the taxonomy is ‘nav_menu’. If you don’t use this plugin, check the others plugins that … Read more

settings api sub menu and data not populating

I don’t know anything about the WeDevs thing, but I do kinda know the Settings API itself. That being said I have a shot in the dark answer. In your wedevs_plugin_page() function, do the methods on the $settings_api object need a parameter for which settings section to display? Like $settings_api->show_navigation(‘wedevs_basic’);? Or maybe the object instantiation … Read more