Currently I’m building a plug-in for wordpress, where I have a couple of webpages with tables, filled with data from a database. Right now I’m working on the part where I click on a number (MemberID) which should redirect to a page, having all the information from another table regarding this number. I’ve tried transfering the data through the URL, with both
?MemberID=".$item->MemberID."
and
/MemberID="$item->MemberID."
, but everytime I try to alter the URL, the webpages suddenly can’t seem to find itself anymore. I’m sure it has to do whith this part of the code:
add_submenu_page( null , 'Manage memberDetails' , 'memberDetails' , 'manage_options', 'memberDetails' , 'memberDetails_list' );
where the fifth value sets the URL for this page to be
http://localhost/wordpress/wp-admin/admin.php?page=memberDetails
So whenever I try to add something behind that URL, it doesn’t acknowledge the existance of said page anymore, resulting in a redirection error.
Is there a way to transfer the variable without using the URL, or is there a way to give more of a dynamic to the URL?
You are using add_submenu_page wrong. The first param is required and can not be null.
https://codex.wordpress.org/Function_Reference/add_submenu_page
You need to get that fixed first so you page properly works.
As someone pointed my fairly basic mistake out this is what went wrong:
The URL is
where I tried to turn it into
which creates a whole new webpage and is therefor impossible in this case. I need to transfer the variable behind the memberID=, not refer to a whole new webpage. The other thing I tried to do was
which is impossible, because the second ? in the URL needed to be replaced with a &
From there on, it was pretty easy to use $_GET to retrieve the variable from the URL and use it.
So for extra clarity, this is how the URL is supposed to look