0

I am trying to add a new page to the admin area:

add_action('admin_menu', 'laksh_advert_menu');
function laksh_advert_menu() { 
  add_menu_page( 
      'Advert', 
      'Advert', 
      'edit_posts', 
      'advert', 
      'laksh_advert_page', 
      'dashicons-admin-tools'
     );
}

function laksh_advert_page() {
    echo "Hello";
}
  • Your code works fine! The menu item for your page appears at the bottom of the left sidebar as you didn't specify any position. Add a position number as the last argument for the add_menu_page() to move it up. with 10 it will appear after posts and media. developer.wordpress.org/reference/functions/add_menu_page – freejack May 31 '19 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.