I am creating a plugin that resides at http://localhost/test/wp-admin/options-general.php?page=my-plugin
I am trying to add a query string to this page so that it can be used in my plugin such as http://localhost/test/wp-admin/options-general.php?page=my-plugin?myVar=cool
The problem is that this prompts wordpress to display the “You do not have sufficient permissions to access this page.” page.
How can I add a query string to my plugin URL? Is this documented someplace?
thanks for the help.
When you don’t know if query string was started or not you can use add_query_arg
which it knows how to deal with that and adds the “
?
” or “&
” marks (which ever one is needed) to the query string.Update
By popular demand I’m adding a few examples that are from the codex:
Using get_permalink:
more general:
Or for use with any link you have you can pass the link uri:
to get
http://wordpress.stackexchange.com/questions/14827/?hello=world
Example plugin page URL with extra query args: