> Form to Post wordpress plugin resources analysis

Form to Post wordpress plugin resources analysis

Download This Plugin
Download Elegant Themes
Name Form to Post
Version 0.6
Author Michael Simpson
Rating 100
Last updated 2014-08-29 07:23:00
Downloads
4203
Download Plugins Speed Test plugin for Wordpress

Home page

Delta: 0%

Post page

Delta: 0%
Form to Post plugin has no negative impact on PageSpeed score.

Home page PageSpeed score has been degraded by 0%, while Post page PageSpeed score has been degraded by 0%

Form to Post plugin added 3 bytes of resources to the Home page and 20 bytes of resources to the sample Post page.

Form to Post plugin added 0 new host(s) to the Home page and 0 new host(s) to the sample Post page.

Great! Form to Post plugin ads no tables to your Wordpress blog database.

Create a WP Post from a Form Submission. Create a form using Contact Form 7, Fast Secure Contact Form, or just a plain form, be sure to name your fields correctly, then the form submission will be sent to a post.

Very limited.

  • Only accepts text, no images, videos, etc.
  • No error handling.

Essentially you can think of this as a form wrapper around the wp_insert_post fuction. The field name-value pairs of the form become inputs to a wp_insert_post call.

WARNING: using this plugin provides spammers the opportunity to send you automated spam form submissions.

How To

  1. Create a form using Contact Form 7 (CF7), Fast Secure Contact Form (FSCF), or create your own form HTML.
  2. Name your fields according to the parameters of the wp_insert_post function.

Minimally, your form must have the following two fields. A post will not be created if one or both is missing.

  • post_title
  • post_content

Special Fields

  • post_category_name can be used to set the category of the post

As hidden field: If you want to make all the posts be of the same category, create a "post_category_name" hidden field whose value is the category name. If using CF7, it does not provide hidden fields. But you can add them by adding the plugin Contact Form 7 Modules.

As checkboxes: to make the category choosable by the user via a checkbox, create a checkbox form field named "post_category_name" with each having a value that is a category name. (If writing your own HTML directly, use "post_category_name[]", see "Plain Form Example" below).

CF7 Form Definition Example:

Post Title [text* post_title] <br/>

Post Content (required) <br/>
   [textarea* post_content] <br/>

Categories (required) <br/>
  [checkbox* post_category_name "Uncategorized" "Cat1" "Cat2" "Cat3"] <br/>

[submit "Post"] <br/>

Aside: if you are familiar with wp_insert_post, then you will know that there is a "post_category" parameter but no "post_category_name". The problem with "post_category" is it requires category ids (the numbers). But what you really want in a form are the category names. So this plug allows for "post_category_name" which can be one or more category names. It looks up the associated category numbers and sets "post_category" for wp_insert_post. But you can use "post_category" instead if you like. But do not use both in the same form.

  • post_author_name

Whereas post_author requires an user id number, you can alternatively use post_author_name takes the login name. (Same idea as post_category_name an an alternative to post_category).

  • post_author_default

A weaker form of post_author_name, takes a login name. When not using post_author_name or post_author_default, then an author will only be set on the post if a person is logged in. In that case his login is used. If you use post_author_name then that ignores the user's login and sets the author to the post_author_name value. If you use post_author_default instead, then it will use the user's login id if he is logged in, but if he is not logged in it will set the author to the value of post_author_default.

Not using CF7 nor FSCF You can define your own form naming fields as described above. But you need to do one extra step in this case. You need to have the target page of your form insert the data in the post. You do this by means of a short code [capture-form-to-post]. Simply place the short code on your form's target page and it will capture the submission and create a post.

Plain Form Example:

In this example, we create our own form, that posts to the same page. So we put both the short code and the form definition in the same page. The short code only does something when there are post parameters. NOTE: your form must have method="post" not "get".

[capture-form-to-post]
<form action="" method="post">
   Post Title: <input type="text" name="post_title" value=""/><br/>
   Post Content: <br/>
   <textarea rows="10" name="post_content" cols="20"></textarea>
   <input type="checkbox" name="post_category_name[]" value="Uncategorized">Uncategorized<br>
   <input type="checkbox" name="post_category_name[]" value="Cat1">Cat1<br>
   <input type="checkbox" name="post_category_name[]" value="Cat2">Cat2<br>
   <input type="checkbox" name="post_category_name[]" value="Cat3">Cat3<br>
   <input type="submit" />
</form>

Remember: do NOT use [capture-form-to-post] if your form is a CF7 or FSCF form.

Advanced:

There are many more parameters to wp_insert_post that can be set simply by putting a form fields in your form of the same name as the wp_insert_post parameter. Examples are:

  • post_status which will be set to 'publish' by default making the post published automatically. But you could set that in a hidden field to 'draft', 'publish', 'pending', 'future', 'private'
  • comment_status which can be 'closed' or 'open'
  • post_excerpt
  • post_date (format: Y-m-d H:i:s, e.g. "2012-01-01 15:30:00")
  • And many more, see wp_insert_post function
  • page_template: set to the name of a page template file (e.g. "new_template.php").
  • NOTE: tax_input is NOT supported.
  • NOTE: If you would want to edit a form, you would need to get the post's ID and put it in a form 'ID' field.

Setting Post Meta (Custom Fields):

You can optionally set "post meta" (custom field) key-value pairs on your post. To do this, add fields to your form whose name start with "meta_". For example, if you want to set the post meta key "my_key" then create a form field named "meta_my_key". The "meta_" prefix is used to identify the field as a post meta field and the "meta_" gets stripped off. Then a call to update_post_meta is made give that key and the field's value.

Resources added by plugin to Home page/Post page in kB
Total size of resources for Home page/Post page in kB
Random Theme Tests
SilverBack screenshot

SilverBack

by: designstrike

7259
0%
Alice screenshot

Alice

by: BlogSynthesis

7919
100%