admin管理员组

文章数量:1122832

You do not have sufficient permissions to access this page. This is the error i am facing while making my own plugin.Actually, i want to link to another page.

Wordpress version is 3.8.1 I made a plugin that shows the following display(the index page of my crud plugin)

I want the Add New link to redirect to other create.php(which is in the same folder as crud.php the index php file).But it says You do not have sufficient permissions to access this page. Is it correct the way i link to create.php file inside my plugin folder? I tried to read abt cross page call in wordpress but no luck. I tried different plugin video tutorial every video ends in the same page. I want to be redirected to the create.php page with the same sidebar and topbar in crud page. And of course i have nicely embeded the html code and php code it's just i did not know the way to show them nicely here. I want a redirect to prevent from inserting data to my table everytime the page is refreshed. And my folder struncture is as follows

The code is as follows

add_action('admin_menu','crudindex');
function crudindex(){
    add_options_page('Crud Dashboard', 'Crudboard', 'manage_options', 'crud', 'crudboard');
}

function crudboard()
{
    <div class="wrap">
        <h2>
            Motors
            <a class="add_new-h2" href="<?php bloginfo('url');?>/wp-admin/options-general.php?page=create">Add New</a>

        </h2>
        <table class="wp-list-table widefat fixed pages">
        </table>
}

I know this is a repeat question.I post it beacause i didn't find the correct answer. Thanks

You do not have sufficient permissions to access this page. This is the error i am facing while making my own plugin.Actually, i want to link to another page.

Wordpress version is 3.8.1 I made a plugin that shows the following display(the index page of my crud plugin)

I want the Add New link to redirect to other create.php(which is in the same folder as crud.php the index php file).But it says You do not have sufficient permissions to access this page. Is it correct the way i link to create.php file inside my plugin folder? I tried to read abt cross page call in wordpress but no luck. I tried different plugin video tutorial every video ends in the same page. I want to be redirected to the create.php page with the same sidebar and topbar in crud page. And of course i have nicely embeded the html code and php code it's just i did not know the way to show them nicely here. I want a redirect to prevent from inserting data to my table everytime the page is refreshed. And my folder struncture is as follows

The code is as follows

add_action('admin_menu','crudindex');
function crudindex(){
    add_options_page('Crud Dashboard', 'Crudboard', 'manage_options', 'crud', 'crudboard');
}

function crudboard()
{
    <div class="wrap">
        <h2>
            Motors
            <a class="add_new-h2" href="<?php bloginfo('url');?>/wp-admin/options-general.php?page=create">Add New</a>

        </h2>
        <table class="wp-list-table widefat fixed pages">
        </table>
}

I know this is a repeat question.I post it beacause i didn't find the correct answer. Thanks

Share Improve this question asked Mar 14, 2014 at 10:38 ugeneugene 1215 bronze badges 2
  • Can you link us to the original question you repeated? – Tom J Nowell Commented Mar 14, 2014 at 10:53
  • stackoverflow.com/questions/7118067/… – ugene Commented Mar 14, 2014 at 10:57
Add a comment  | 

2 Answers 2

Reset to default 0

Try

function crudindex(){
   add_options_page('Crud Dashboard', 'Crudboard', 'manage_options', 'crud', 'crudboard');
   add_options_page(NULL, 'Crudboard', 'manage_options', 'create_crud', 'crudboard');
}

and your anchor tag like

<a class="add_new-h2" href="<?php bloginfo('url');?>/wp-admin/options-general.php?page=create_crud">Add New</a>

Another way you can do that

function crudindex(){
   add_options_page('Crud Dashboard', 'Crudboard', 'manage_options', 'crud', 'crudboard');
   add_options_page('Crudboard', 'Crudboard', 'manage_options', 'create_crud', 'crudboard');
}


function remove_submenus() {
   global $submenu;
   echo "<pre>" . print_r($submenu['options-general.php'], true) . "</pre>";
   unset($submenu['options-general.php'][your-menu-array-key]);
}
add_action('admin_menu', 'remove_submenus');

Above will show all sub navigation under settings you find your menu position key and replace with your-menu-array-key

本文标签: phpYou do not have sufficient permissions to access this page while making a plugin