Monday, November 23, 2020
Home Blogging How to Add / Remove Default Pages in WordPress Multisite

How to Add / Remove Default Pages in WordPress Multisite

When you find yourself working a WordPress multisite, every time a brand new website is created WordPress mechanically provides a pattern web page to the brand new website. Not too long ago, one in every of our customers requested us if it was doable to take away the default pattern web page and add their very own default pages. On this article, we’ll present you how one can add / take away default pages in WordPress multisite.

Why Add Your Personal Default Pages in WordPress Multisite?

There will be many causes to exchange the default pattern web page with your personal. For instance, you might wish to add a web page telling customers what to do subsequent.

The default pattern web page generated by WordPress is just a little boring. Possibly you want to add one thing witty and intelligent?

Lastly, you should use the default web page to inform customers the do’s and don’ts of your multisite community.

Including / Eradicating Default Pages in WordPress

Merely add this code to your essential website’s capabilities.php file or a site-specific plugin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
add_action('wpmu_new_blog', 'wpb_create_my_pages', 10, 2);
function wpb_create_my_pages($blog_id, $user_id){
  switch_to_blog($blog_id);
// create new page
  $page_id = wp_insert_post(array(
    'post_title'     => 'About',
    'post_name'      => 'about',
    'post_content'   => 'This is an about page. Feel free to edit or delete this page.',
    'post_status'    => 'publish',
    'post_author'    => $user_id, // or "1" (super-admin?)
    'post_type'      => 'page',
    'menu_order'     => 1,
    'comment_status' => 'closed',
    'ping_status'    => 'closed',
 )); 
  
// Find and delete the WP default 'Sample Page'
$defaultPage = get_page_by_title( 'Sample Page' );
wp_delete_post( $defaultPage->ID );
  restore_current_blog();
}

The primary a part of this code inserts a brand new WordPress web page titled ‘About’ each time a brand new website is created in your multisite community. The second a part of the code finds and deletes default WordPress Pattern Web page.

You May Also Like : How to Install WordPress On a USB Stick Using XAMPP

We hope this text helped you add / take away default pages in WordPress multisite community.

If you liked this article, make sure to hit the bell for getting our latest updates and share this article with your friends in every social media platforms.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

50 Best Online Jobs From Home For Students – Earn 20K PM

In latest years, the alternatives for online jobs from home for students have gained great reputation. This is as a result of many of the...

Best Answers to the Question “Why should you be hired for this Internship?”

What is the greatest approach to ace an internship interview? Especially for a more energizing who has by no means appeared for a job-related...

Does Instagram Notify You if Someone Screenshots Your Story?

When Snapchat first burst on the scene, there have been loads of individuals very completely happy concerning the prospect of sending pictures to people...

How to Change Background Color on Instagram Story

It's arduous for me to recollect Instagram earlier than the tales characteristic was launched — it is a simple possibility for sharing updates and...

Recent Comments