What are the available options for “Name” in WP search?

There are two name‘s:

  • The name query variable
  • The name attribute in an input tag

The Query Variable

name represents the post slug.

For example, I have a blog post on my site:

https://tomjn.com/2018/07/23/deployment-and-wordpress/

It has this post name:

deployment-and-wordpress

I can also visit this URL:

https://tomjn.com/?name=deployment-and-wordpress

I could also find it via WP_Query in code using this query:

$query= = new WP_Query([
    'name' => 'deployment-and-wordpress'
]);

The name="..." attribute on an Input

As for the name parameter in a form input, those are query variables, the same ones passed to WP_Query. These are whitelisted internally, but you can refer to the WP_Query documentation for a full list and explanation:

https://developer.wordpress.org/reference/classes/wp_query/

Note that these docs assume you’ll be writing PHP code, you may be better off using a pre_get_posts query to give yourself more options in some situations.

Using other values for the name input field won’t have any effect on the main query, unless you write code to read it in and make changes yourself.

Keep in mind that this won’t work if your themes template discards the main post query and creates a fresh brand new one of its own. That would be bad practice for numerous reasons, and I would suggest instead using the pre_get_posts filter to change what WP fetches from the database in PHP.

A Note on Permalinks and Pretty URLs

When WordPress sees a pretty URL such as:

https://tomjn.com/2018/07/23/deployment-and-wordpress/

It uses the rewrite rule system to turn it into:

https://tomjn.com/index.php?name=deployment-and-wordpress

Then, once that’s been done, it processes the result, passing the parameters that are query variables into a WP_Query, e.g.

$wp_query = WP_Query([
    'name' => get_query_var( 'name' ),
]);
// etc

This is why adding parameters via form inputs or in the URL can change the posts WordPress retrieves, e.g. you can add ?s=test to the end of a category archive to search in just that category, or add an input to change parameters, not just in search but on any WordPress post archive.

A Final Note on The Codex

I would also note, that the codex is old, and was replaced by the dev hub at https://developer.wordpress.org/ many years ago. The Handbook and code reference on that site are far superior.