WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to develop a plugin that generates a page and embeds the page link in pages menu in the client part at the time of plugin activation.

Please help me with this.

share|improve this question
up vote 2 down vote accepted

You can create the page using wp_insert_post() and make sure you send post type as 'page'. and if the user nav menu uses wp_list_pages the page will be added to the nav menu automatically and to run it on activation you can have you plugin check if it exists and save its id so it will only create it once.

$my_page = get_option('my_plugin_page');
if (!$my_page){
    // Create post/page object
    $my_new_page = array(
        'post_title' => 'My page',
        'post_content' => 'This is my page content.',
        'post_status' => 'publish'

    // Insert the post into the database
    $my_page = wp_insert_post( $my_new_page );
share|improve this answer
hey sorie for the late response .. Anyways, thanks for the answer . . :)) – coosal Mar 16 '11 at 6:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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