Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6319625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:50:16+00:00 2026-05-24T15:50:16+00:00

What I want to do is to create a simple front-end post submit form,

  • 0

What I want to do is to create a simple front-end post submit form, for every different type of post I will include in my WordPress app. For example there will be articles, events, quick messages and those types will have a different design/structure for a user to see.
Author will use those forms to post their content.

As far as I know, I can have a different template for those types with the if in category function but I am interested in alternative solutions (maybe better). I know that there is page_template to add in the array http://wpengineer.com/1229/puplishing-extend-of-wordpress/ but is there anything else?

Also I am having some difficulties to redirect or even echo the posted link (as below). For your concern, I can not echo the $link .

Thank you for your help.

if(isset($_POST['submit'])){

    global $user_ID;

    $new_post = array(
        'post_title' => $_POST['post_title'],
        'post_content' => $_POST['post'],
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    );

    wp_insert_post($new_post);
}

I tried this for redirect without luck even I echo the link

$pid = wp_insert_post($new_post);
$link = get_permalink( $pid );
echo $link;
wp_redirect( $link );
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T15:50:16+00:00Added an answer on May 24, 2026 at 3:50 pm

    you don’t save the returned p(age_)id from the wp_insert_post().
    just use:

    $pid = wp_insert_post($new_post);
    

    and the rest of the code should work fine

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a simple user registration form with First / Last name,
I want to create a simple CMS for my asp.net-mvc site. Will I save
I want to create a simple http proxy server that does some very basic
I want to create a simple box with a header bar containing a title
I want to create a simple bit of JS code that creates an image
I want to create a simple bash script to launch a Java program on
I want to create a simple transaction on my Web Site where after the
I want to create a simple multiline Alert popup Alert.show(Blah\\nBlah) shows Blah\nBlah when what
I want to create a simple batch file that would perform some Visual Studio
I want to create a simple menu function which can call it example get_menu()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.