My wordpress plugin which adds a menu in admin page has two files.
The code from the primary file (special.php
) is the following:
add_action('admin_menu', 'my_add_pages');
function my_add_pages() {
add_menu_page('special', 'special', 'manage_options', __FILE__, 'specialPage');
}
function specialPage() {
....
}
Within the function specialPage()
, I write a hyperlink:
<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 wish to visit another file special_edit.php
. The file is incorporated in the same folder (plugin/special
) as special.php
.
However, if i click on the "Edit" link, it jogs my memory that "You don't have sufficient permissions to gain access to this siteInch.
Where does the issue originate from? How do i solve it?
Edit table wordpress_usermeta and alter worth of wordpress_abilities to:
a:1:{s:13:âadministratorâ;b:1;}
admin.php?page=special/special_edit.php?do=edit&id=...
I believe you have to replace the 2nd ? having a &lifier
And most likely drop the .php extension from the page parameter (just speculating, here, I've not compromised WordPress much).
[UPDATE] I checked, also it appears by using add_menu_page, you need to use an identifier like 'special_edit'
within the menu slug, rather than __FILE__
. Would look better anyway, and will also be separate from your file names.