Custom url redirect the page say You do not have sufficient permissions to access this page

i have an error message whe i tring to set the page in custom url
can anybody to tell that any action or hook to set the page or function. here is my code

    <a href='<?php echo admin_url("admin.php?page=wp_crm_asign&user_id={$user_id}"); ?>'>Asign to Consultant</a>

   add_action( 'admin_init', 'wp_crm_asign_admin_init' );


     function wp_crm_asign_admin_init() {

       if ($_GET['page'] == 'wp_crm_asign') {

        echo "hello";

        }
       }

Can Anybody to tell the right way to do this.
thanks

Related posts

1 comment

  1. You will have to create sub menu page with parent slug null, check here

    add_submenu_page(null,$page_title,$menu_title,8,'wp_crm_asign','wp_crm_asign_admin_init');

    Remove the admin_init hook and the function will automatically be called through this menu.

    click Here to check the wordpress function.

Comments are closed.