I have a relevant question.
If at the top of my target page I execute this:
print_r( $wp_query->query_vars);
I can see a list of the valid query_vars … nice. However, if I actually use any one of them (like author_name), the target page redirects to 404.php. Why is that?
The only way to make it work is to use a parameter that is NOT in the approved list and that seems the opposite of the intention.
For example, I set up a test …
1. Construct these links in the page you want to link from:
https://example.com/target-page/?author_name=joeuser
https://example.com/target-page/?author_name_alt=joeuser
2. Then on that target-page use:
$author = $_GET['author_name'];
or
$author = $_GET['author_name_alt'];
The target-page using the existing ‘author_name’ var returns 404.php, but the alternate, made-up var name works (accepting the url parameter). There is obviously something special about the way wordpress handles that list of query_vars.
What is the point of having query_vars then?
What am I missing?
Edit: I just noticed that the resulting 404.php “not found” page url now has the parameter value embedded like this:
https://example.com/target-page/joeuser
hmmm, the plot thickens. Does wordpress have an internal redirect thing going on?