Add custom page to admin menu visible only to admins
-
Hello,
I want to build a custom survey and display his results in the wordpress backend.
I added a new admin menu item like this:
add_action( 'admin_menu', 'register_survey' ); function register_survey(){ add_menu_page( 'Survey', 'Survey', 'manage_options', '/survey/survey-admin.php', '', '/wp-admin/survey/icon.png', 30 ); }
The menu item named Survey appears in the backend. When i click it goes to /wp-admin/survey/survey-admin.php displaying my php file contents, but the dashboard dissapears with the sidebar menus… This page is also visible to everyone and wordpress function is_admin doesn’t work anymore in this page…
What’s the correct solution? I just want to display my custom page on wordpress backend and be able to check if the user is admin or not. Do i need to create a plugin for this?
Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add custom page to admin menu visible only to admins’ is closed to new replies.