WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to figure out on how do I make my wordpress website to be able to add portfolio items from the frontend. Plugins such as WP-User-Frontend allows posting from frontend but only works with blog posts.

Is there any ways or any plugins similar to wp-user-frotend but being able to add custom post type items?

share|improve this question
up vote 5 down vote accepted

If you are willing to pay for it, the Gravity Forms plugin allows you to create forms that map to your Custom Post Types (even regular post and page - types) as well as map to your custom fields.

For those who aren't and who are willing to roll up their sleeves then you can create a front end form that posts data into any post type of your choosing quite easily.

Here is a basic example;

if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == "my_post_type") {

//store our post vars into variables for later use
//now would be a good time to run some basic error checking/validation
//to ensure that data for these values have been set
$title     = $_POST['title'];
$content   = $_POST['content'];
$post_type = 'my_custom_post';
$custom_field_1 = $_POST['custom_1'];
$custom_field_2 = $_POST['custom_2'];    

//the array of arguements to be inserted with wp_insert_post
$new_post = array(
'post_title'    => $title,
'post_content'  => $content,
'post_status'   => 'publish',          
'post_type'     => $post_type 

//insert the the post into database by passing $new_post to wp_insert_post
//store our post ID in a variable $pid
$pid = wp_insert_post($new_post);

//we now use $pid (post id) to help add out post meta data
add_post_meta($pid, 'meta_key', $custom_field_1, true);
add_post_meta($pid, 'meta_key', $custom_field_2, true);


Your HTML form would look something similar to;

<form method="post" name="front_end" action="" >
<input type="text" name="title" value="My Post Title" />
<input type="text" name="content" value="My Post Content" />
<input type="text" name="custom_1" value="Custom Field 1 Content" />
<input type="text" name="custom_2" value="Custom Field 2 Content" />
<button type="button">Submit</button>
<input type="hidden" name="action" value="my_post_type" />

You can place this all into your theme template file. Normally, I would take it a step further and run the processing logic (PHP) from a function within my functions.php hooked onto an action however it will work from within a theme file too.

This is only intended to be a basic example and its void of any serious error checking and validation. However this gives you the essential framework for what you need to be posting from the front end to your post types in the back end.

There are also numerous tutorials that expand on the subject on WPSE if you run a search you will find a wealth of information.

share|improve this answer
And how about files attached in meta fields? – Gacek Jun 12 '15 at 13:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.