Use an empty action attribute in forms

When developing a simple form to use in your WordPress theme or plugin you often want to post to the same page.

To do so, simply leave the action attribute empty in your form.

<form action="" method="post">
<label>Name</label><br />
<input type="text" name="your_name" />
<input type="submit" value="Send" />

Notice that your_name is used, using simply name as the attribute value may cause some trouble. At least it did for me.

Mark Jaquith has written a bit more detailed about the action attribute.


Web Developer @ Oakwood Creative -

Tagged with: ,
Posted in Best Practices, Intermediate

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


WordPress Quick Tips is a blog supplying great tips about WordPress.

We hope to create a great knowledge resource for WordPress developers as well as serving a reminder for all the forgetful ones.

The blog is created and run by Vincent of Oakwood Creative

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 121 other followers

%d bloggers like this: