I'm trying to create an events plugin and so far, I'm through with the following:

  1. A short-code that displays a form on the front-end to the user.
  2. The event display page that renders the output.
  3. 'Events' as custom post type and several custom-fields for additional event information.


  1. I want to restrict the users from submitting more than one event.

  2. If the user has already published an event, he/she should be presented with a form that has their earlier values (aka values of custom fields) prefilled. They can edit these values and save to update the event display page.

If they haven't published any event before, show a blank form with regular placeholders.

I'm unable to think about any approach to address this issue. Would really appreciate if you could point me in the right direction.

Thank you for your time and I look forward to getting response.

  • So, your problem is what? If I understood correctly, you want to restrict one post (event) per user. Am I right?
    – cybmeta
    Commented May 30, 2016 at 10:49
  • Well, I was able to fix the problem. First, I created a conditional to check if the user has already 'published' a post. If yes, I simply redirect them. I found out that I can use update_post_meta with the post ID without any problem. I simply use that information to populate my fields. I'm wondering how do I set 'placeholder' and 'value' in my forms. Value seems to take over placeholder.
    – TheBigK
    Commented May 31, 2016 at 3:45
  • 2
    Please, post it as answer. You will help other users with the same problem. Answering own answer it is really great.
    – cybmeta
    Commented May 31, 2016 at 4:35
  • @TheBigK Just a gentle reminder to post your comment as an answer and accept it :) At the moment this question is still coming up in our unanswered list. Re placeholder and value, this is an HTML question rather than a Wordpress one, but the answer is you generally use one or the other. You could use both, but the user would need to remove the value to see the placeholder.
    – Tim Malone
    Commented Jun 5, 2016 at 19:54

2 Answers 2


Answer from comments:

First, create a conditional to check if the user has already 'published' a post. If yes, simply redirect them.

One can use update_post_meta with the post ID without any problem. Simply use that information to populate the fields.


Check the current user info, then query for posts by that user, depending on query (has posts?), output the data/form you need.

    // Retrieve current user info
    $current_user = wp_get_current_user();                      

    // Prepare the query for posts by that author
    $args = array(
        'author' =>  $current_user->ID, 
    $author_posts = new WP_Query( $args );

    // Depending on query results, output what you need
    if($author_posts->have_posts()) {
       // display the edit form
    } else {
       // display the new post form


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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