0

I am developing a Wordpress plugin handling a calender in which it is possible to sign up for a given event. As part of this, I want to make a custom page for the signup-form and confirmation message to the client, however I have no idea how to do this.

I have seen that there is a wp_insert_post() function to insert a new post, but I need a page with custom plgin content (signup form) instead.

Is this even possible to do and how do I do this if it is?

Thanks

1 Answer 1

1

You can use wp_insert_post for creating the page.

<?php
    $content = '<Sign up form content>';
    wp_insert_post(array(
        'post_title' => 'My page',
        'post_content' => $content,
        'post_type' => 'page', //VERY IMPORTANT
        'post_status' => 'publish/draft'
    ));

Check it.

2
  • Just one more question: how do I then access this page using a link?
    – Simon
    Aug 23, 2012 at 8:02
  • 1
    Check the Pages section for your custom page and check it's permalink. Aug 23, 2012 at 8:59

Your Answer

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

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