Support » Plugins » Hacks » wp_insert_post fron a page

  • Resolved Steffen Jørgensen


    I’m trying to write a form for visitors to submit content (posts) directly from a page I have created.

    I’m using the “wp_insert_post” function, and found this tutorial:

    However, I can’t make it post to the database — it just returns a “page not found” when submitted.

    Any pointers or tips?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • At the top of the form, action is left blank:

    Action specifies where the form should send the data. The php, which handles the data from the form must be saved to a file on your web server, at the root of the wp installation. If you were to name this ‘frontpost.php’, you would amend action as follows:


    That way the form sends the data to the php file, which then processes it.

    Hope that helps – I’m trying to use this too, but i’m getting the following error:

    Fatal error: Call to undefined function wp_insert_post() in /homepages/25/d288611421/htdocs/intranet/front-post.php on line 26

    Something in the php doesn’t seem to be working.

    If action is left blank and you only have _POST info for the title and content then it works, but if you have any fields that are meant to add meta data, then the php breaks and returns a 404 error.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_insert_post fron a page’ is closed to new replies.