Support » Plugins » How to create a new page with a plugin?

  • Hi,

    I’m attempting to create a plugin that adds a new page to WordPress. However, I have trawled the Plugin documentation looking for a way to do this and can’t find anything.

    The closest I came was this forum thread which talks about using XML-RPC from an external script, which doesn’t fit the need.

    Anybody know how to do this?

    Many thanks,
    Phil

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter philpeter

    (@philpeter)

    Okay, I went cruising around the code of some other plugins and I’m thinking that I actually just have to perform an INSERT query on the database directly, with all the relevant information.

    Anybody care to concur?

    Phil

    Thread Starter philpeter

    (@philpeter)

    Right… I tried the INSERT query idea without success.

    The front page of the blog actually displays the page as if it was a post and somehow every post/page is now the same as my new page….

    Surely there’s a standard way to add a new page? A WP function? Anything?

    paamayim

    (@paamayim)

    I bring up this post.

    I also I was wondering if it could be possibile from within a plugin to dinamically create a static page based on a template file present in the theme.

    Thanks

    wrighting directly to the DB should work if you know all the tables and fields you need to hit… I wouldn’t recommend it though.

    this topic is of use to me as well and looking through the function list I quickly found this function:
    http://codex.wordpress.org/Function_Reference/wp_insert_post

    it works for pages as well as posts.

    I don’t know how much use it is to the OP but I found it useful and hopefully the next time someone searches this topic they’ll see this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to create a new page with a plugin?’ is closed to new replies.