admin管理员组文章数量:1122826
i've got a question. I created a plugin with a menu and i want to show this under the Dashboard menu-item. In some of my wordpress installations the dashboard item will be overwrited. How can i fix this?
My code to add the menu is:
add_menu_page('pluginname', 'pluginname', 'manage_options', 'pluginname-hello', '', 'dashicons-admin-site', 2);
i've got a question. I created a plugin with a menu and i want to show this under the Dashboard menu-item. In some of my wordpress installations the dashboard item will be overwrited. How can i fix this?
My code to add the menu is:
add_menu_page('pluginname', 'pluginname', 'manage_options', 'pluginname-hello', '', 'dashicons-admin-site', 2);
Share
Improve this question
asked Mar 14, 2017 at 8:53
ThomGOThomGO
414 bronze badges
2 Answers
Reset to default 0add_submenu_page('index.php', __('Plugin Name from page', 'pluginname'), 'Plugin Name', 'manage_options', 'pluginname-hello', 'you_call_function' );
pluginname-hello
- The slug name to refer to this menu by (should be unique for this menu).
you_call_function
- The function to be called to output the content for this page.
More information: https://developer.wordpress.org/reference/functions/add_submenu_page/
The code must be work. Add the code in functions.php and check result.
function admin_menu(){
add_menu_page('pluginname', 'pluginname', 'manage_options', 'pluginname-hello', '', 'dashicons-admin-site', 2);
}
add_action('admin_menu', 'admin_menu', 99);
//add_action('admin_menu', array($this, 'admin_menu'), 99); //for class based.
If you face the problem further change the priority of admin_menu hook like 99 to 1 or 2 as per your need.
本文标签: WordPress Plugin menu position overwrite other item
版权声明:本文标题:WordPress Plugin menu position overwrite other item 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736288846a1928179.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论