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

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

tech