My plugin which adds a menu in admin page has two files.
The code of the main file (special.php) is as follows:
add_action('admin_menu', 'my_add_pages');
function my_add_pages() {
add_menu_page('special', 'special', 'manage_options', __FILE__, 'specialPage');
}
function specialPage() {
....
}
In the function specialPage(), I write a link:
<a href="admin.php?page=special/special_edit.php?do=edit&id=<?php echo $spec->spec_id;?>">Edit<a>
I write this link because i want to go to another file special_edit.php. The file is in the same folder (plugin/special) as special.php.
However when i click the “Edit” link, it reminds me that “You do not have sufficient permissions to access this page”.
Where does the problem come from? How can I solve it?
I think you must replace the second ? with a &
And probably drop the .php extension of the page parameter (just guessing, here, I haven’t hacked WordPress much).
[UPDATE] I checked, and it seems that with add_menu_page, you should use an identifier like
'special_edit'in the menu slug, instead of__FILE__. Would look nicer anyway, and will be independent of your file names.