Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPressマルチサイトの初期設定ページの追加・削除方法

WordPressでマルチサイトを運営している場合、新しいサイトが作成されるたびに、WordPressは自動的にサンプルページを新しいサイトに追加します。最近、あるユーザーから、デフォルトのサンプルページを削除して、独自の初期設定ページを追加できないかという問い合わせがありました。この投稿では、WordPressマルチサイトで初期設定ページを追加/削除する方法を紹介します。

なぜWordPressマルチサイトで独自の初期設定ページを追加するのか?

初期設定のサンプルページを独自のページに置き換える理由はたくさんあります。例えば、ユーザーに次に何をすべきかを伝えるページを追加したい場合があります。

WordPressが初期設定するサンプルページは少し退屈です。何か気の利いた、気の利いたことを追加したいのではないでしょうか?

最後に、初期設定のページを使って、マルチサイトネットワークの注意事項をユーザーに伝えることができます。

WordPressで初期設定ページを追加/削除する

このコードをメインサイトのfunctions.phpファイルまたはサイト固有のプラグインに追加するだけです。

[cbk1]

このコードの最初の部分は、マルチサイトネットワークに新しいサイトが作成されるたびに、「About」というタイトルの新規WordPressページを挿入します。コードの2番目の部分は、初期設定のWordPressサンプルページを見つけて削除します。

この投稿がWordPressマルチサイトネットワークの初期設定ページの追加/削除のお役に立てば幸いです。

この投稿が気に入ったら、Google+や Twitterに参加してください。また、より多くのWordPress動画チュートリアルのために私たちのYouTubeチャンネルを購読することができます。

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

7件のコメントLeave a Reply

  1. Don’t forget handle other languages too: in $defaultPage = get_page_by_title( ‘Sample Page’ ); , use:

    $defaultPage = get_page_by_title( __(‘Sample Page’) );

    This way, the Sample Page word will be translated and the page will be found in any language.

  2. what do you mean about, “Simply add this code to your main site’s functions.php” in the theme functions.php?

  3. how to removing with page more than one,for example page title(‘Sample page’,’MY product’,’Contact ‘)

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.