Why does WordPress automatically redirect URLs with the parameter “name=” to a different page?

How do I disable this automatic redirect of the name variable so that I can use it on my call booking landing page?

I’m setting up a call booking page here: https://www.themcmethod.com/talk/

I want to add the URL parameters “name” and “email” so I can automatically populate the form.

Problem is, when I add the “name” parameter, WordPress assumes I want to redirect to a page with the name in it.

For example…

https://www.themcmethod.com/talk/[email protected] redirects to the call booking page fine, but if I add a name field, it redirects to the most likely page on the website.

Therefore, https://www.themcmethod.com/talk/?name=John&[email protected] redirects to my podcast with John Carlton https://www.themcmethod.com/john-carlton-on-6-key-elements-of-powerful-profitable-email-marketing/

And https://www.themcmethod.com/talk/?name=Mary&[email protected] redirects to a lightbox popup with “Mary” in the title.

How do I disable this automatic redirect of the name variable?

I’ve tried disabling all plugins, but it doesn’t work.

I’ve tried disabling that WordPress automatic guessing function, but it didn’t work either.

It seems like there’s two steps.

WordPress takes name= and redirects it to the most likely URL, so name=John redirects to themcmethod.com/john.

Then the other step kicks in, whereby if themcmethod.com/john is a 404, wordpress automatically redirects to the most likely page with “John” in the title.

Apparently the guessing function is good for SEO, so I don’t want (or need, for that matter) to disable it. I just want to stop the name=John redirect.

2 Answers
2

In WordPress, name is a reserved term (emphasis mine):

There is a complete set of reserved keywords, or terms, in WordPress
that should not be used in certain circumstances as they may conflict
with core functionality. You should avoid using any of these terms
when:

  • Passing a term through a $_GET or $_POST array
  • Registering a taxonomy or post type slug
  • Handling query variables

In this case, this is not just a redirect. Internally, all WordPress pages and posts are accessed via query parameters on index.php, so whenever you access a URL like https://example.com/post-name/, you’re actually loading https://example.com/index.php?name=post-name. So if you somehow changed WordPress so that posts were not accessible with the name parameter, you’d break all of your post permalinks.

To avoid conflicts with WordPress, you should choose something else for your parameter, such as first_name, or full_name.

Leave a Comment