Advertisement
fauzanjeg

Example Add New Menu in Account Menu and Change the position

Sep 28th, 2021
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. /* Example Add New Menu in Account Menu and Change the position */
  2. function jeg_nav_account_menu( $dropdown ) {
  3.     // var_dump($dropdown); /* For Check the List Menu */
  4.  
  5.     $logout = $dropdown['logout']; /* Save logout menu before remove it */
  6.     unset( $dropdown['logout'] ); /* Remove Logout Menu */
  7.  
  8.     $dropdown['new_menu'] = array(
  9.         'text' => 'New Menu',
  10.         'url'  => 'http://jnews.io',
  11.     );
  12.  
  13.     $dropdown['logout'] = $logout; /* Add Again Logout Menu After Add New Menu */
  14.  
  15.     return $dropdown;
  16. }
  17. add_filter( 'jnews_dropdown_link', 'jeg_nav_account_menu', 99 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement