Theme My Login
Remove Default Pages created on all multisites (3 posts)

  1. MYGM
    Posted 2 years ago #

    Hi, I am using theme my login on my wordpress network setup and I am currently trying to figure out how to remove or stop pages from being created for multisites. I dont want new users that create sites, to see the register, login, etc. pages that are created when making a new site.

    Also if possible I would like to find out how the plugin was able to create these default pages for all multisites, so that I can create my own custom pages that come with a new site.



  2. MYGM
    Posted 2 years ago #

    I figured out how to add default pages for multisites, but how do I remove the TML default pages?

    add_action('wpmu_new_blog', 'create_my_pages', 10, 2);
    function create_my_pages($blog_id, $user_id){
      // not really need, new blogs shouldn't have any content
      if(get_page_by_title('About')) return;
      // create each page
      $page_id = wp_insert_post(array(
        'post_title'     => 'About',
        'post_name'      => 'about',
        'post_content'   => 'This is your about page',
        'post_status'    => 'publish',
        'post_author'    => $user_id, // or "1" (super-admin?)
        'post_type'      => 'page',
        'menu_order'     => 1,
        'comment_status' => 'closed',
        'ping_status'    => 'closed',
         // + see: http://codex.wordpress.org/Function_Reference/wp_insert_post
  3. verticalgrain
    Posted 2 years ago #

    To remove the "Sample Page" that WP creates when each new multisite site is created, add the following to your code block above. Add it just before the restore_current_blog() tag.

    // Find and delete the WP default 'Sample Page'
    $defaultPage = get_page_by_title( 'Sample Page' );
    wp_delete_post( $defaultPage->ID );

    This will delete the page with the title "Sample Page".

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Theme My Login
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic