On the WordPress Admin section how do I link to submenu pages created for a plugin?

So i’m trying to create a WordPress plugin and I’ve created some menu pages using this provided function:

add_submenu_page('my_plugin_menu', 'Edit record page', 'Edit record page', 'manage_options', 'edit_record_page', array(&$this, 'display_edit_record_page');

and when I go to the page I notice on the address bar on the browser it reads something like this:

Read More
http://mydomain.com/wp/wp-admin/admin.php?page=edit_record_page

What I want to do is to be able to link this page but I find I have to hardcode the link for lack of a better way of doing it and I’m working on a dev site. So I was wondering how I could dynamically generate the link I saw on my browser so that when I copy this plugin code onto the production server it will work. Namely, is there a WordPress function that will generate the link portion of the submenu page create.

page=edit_record_page

Also, if I want to append query strings to the to the link is it as simple as adding it manually like so:

http://mydomain.com/wp/wp-admin/admin.php?page=edit_record_page&rec_id=1

or is there an appropriate WordPress function for doing that too?

Related posts

Leave a Reply

2 comments