How can I pass value to function in add_menu_page?

Don’t use a function for the callback, use a class. Something like this: class Competition_Manager_Page { private $extra; public function set_extra( $value ) { $this->extra = $value; } public function render() { // show you page content, then: print $this->extra; } } You can extend the class’ functionality later. Now, when you register the menu, … Read more

Link to a admin submenu item using a custom link

If I understand correctly what you are asking, you need the $menu_slug used when adding your menu pages: //add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); //add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ); $your_link_url = admin_url( ‘admin.php?page=”.$menu_slug, “http’ ); OR SPECIFICALLY FOR YOU $your_link_url = admin_url( ‘admin.php?page=nes_vendor_new’, ‘http’ ); You can always verify … Read more

Is It Possible To A Link To The Homepage From The Admin Sidebar?

The $location parameter was incorrect. Try this: function redirect_to_local_110(){ wp_redirect( home_url() ); exit; } function add_home_link() { add_menu_page( ‘Course’, ‘Course’, ‘read’, ‘home’, ‘redirect_to_local_110’, ‘dashicons-welcome-learn-more’); } add_action( ‘admin_menu’, ‘add_home_link’, 1001 ); Or you could use this: function redirect_to_local_110(){ wp_redirect( ‘http://www.example.com’, 301 ); exit; } function add_home_link() { add_menu_page( ‘Course’, ‘Course’, ‘read’, ‘home’, ‘redirect_to_local_110’, ‘dashicons-welcome-learn-more’); } add_action( … Read more

How can I place a page link to the sidebar admin bar?

I have added custom menu link by following. Hope it will be helpful. add_action( ‘admin_menu’ , ‘custom_admin_menu_new_items’ ); function custom_admin_menu_new_items() { global $menu; add_menu_page( ‘My Page’, ‘My Page’, ‘manage_options’, ‘my-page’, ”,”, 6 ); foreach($menu as $mIndex => $mData) { if($mData[2] == ‘my-page’) { $menu[$mIndex][2] = ‘http://mypage.com/mypage’; break; } } } Action hook admin_menu is used. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)