I am developing pagination for a list of posts in my plugin. I’ve added a custom parameter in my plugin_functions.php
file:
add_query_arg('pworkspage', 1);
As you can see it defaults to “1”. Now, whenever I visit the custom admin page of my plugin with that parameter in the URL (www.example.com/wp-admin/admin.php?page=mycustompage&pworkspage=2
) my script can’t see the parameter at all.
I am retrieving the parameter like this:
$page_nr = get_query_var('pworkspage', 1);
The variable $page_nr
is equal to string(0) ""
.
I tried a different approach using the query_vars
filter but I got the same results.
Am I doing something wrong?