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

WordPressで子ページのURLから親ページのスラッグを削除する方法

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

WordPressで子ページのURLから親ページのスラッグを削除する方法をご存知ですか?

WordPressの初期設定では、親ページのスラッグが子ページのURLのプレフィックスとして追加されます。しかし、親ページのスラッグをURLに入れたくない人もいるでしょう。

この投稿では、WordPressで子ページのURLから親ページのスラッグを削除する方法を紹介します。

How to Remove Parent Slug From Child Page URL in WordPress

WordPressの親ページスラッグとは?

WordPressサイトには投稿とページと呼ばれる2つの主なコンテンツタイプがあります。

ページは階層構造になっており、子ページを持つことができます。これらの子ページは親ページに依存し、通常は親に関連するサブトピックをカバーします。

例えば、「商品」の親ページに「価格」「サポート」「機能」の子ページがあるとします。

初期設定では、WordPressの子ページのURLには親ページのスラッグが含まれます。以下はその例です:

http://example.com/parent-page/child-page/

このようなURLを使用することは、WordPressサイトの階層的なページ構造の中でコンテンツを整理する最良の方法です。これらのURLはWordPressのSEOのベストプラクティスとされており、ユーザーが読んだときに意味がわかるようになっています。

通常、親ページのスラッグを削除するのは良い考えとは言えません。URLを壊してしまう可能性がありますし、SEO的に不利になると考える専門家もいます。WordPressのパーマリンク構造とのコンフリクトを引き起こすこともあります。

私たちの経験では、もし子ページのURLに親ページのスラッグを入れたくないのであれば、子ページをすべて作らないのがベストです。その代わりに、通常のページを作成し、そのページの下に他のページが属していることを示すためにドロップダウンナビゲーションメニューを使用することができます。

Adding Child Items to a Menu

しかし、URL内に親ページのスラッグを含めず、子ページを使用したいユーザーもいることは理解しています。

ということで、WordPressで子ページのURLから親ページのスラッグを簡単に削除する方法を見ていきましょう。

WordPressで子ページのURLから親ページのスラッグを削除する

まず最初に行う必要があるのは、カスタムパーマリンクスプラグインのインストールと有効化です。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

有効化したら、変更したい子ページを編集する必要があります。コンテンツエリアの下に、子ページのURLを変更できる「カスタマイザー」フィールドがあります。

Change child page URL

パーマリンクフィールドにページの初期設定が表示されます。それをクリックして、子ページに使いたいカスタマイザーURLを入力するだけです。

この例では、hollywood-boulevardeページはlocationsの子ページなので、初期設定のパーマリンクはlocations/hollywood-boulevardeとなります。

下のスクリーンショットにあるように、URLからロケーションの親スラッグを削除した。

Custom page URL

更新」ボタンをクリックしてページを保存し、URLの変更を保存することをお忘れなく。

変更を保存すると、プラグインは自動的に古いパーマリンクを新しいアドレスにリダイレクトします。つまり、訪問者がページの古いアドレスへのリンクやブックマークをクリックしても、404エラーは表示されません。

子ページを表示すると、そのURLに親スラッグが含まれていないことがわかります。

ページと子ページに関するベストガイド

WordPressで子ページのURLをカスタマイズする方法がわかったところで、WordPressでのページや子ページの使い方についてさらに詳しく学びたいと思うかもしれません:

WordPressで子ページのURLから親ページのスラッグを削除する方法について、この投稿がお役に立てば幸いです。WordPressでカスタマイザーページを作成する方法、またはWordPressのエキスパートが選ぶドラッグ&ドロップページビルダープラグインもご覧ください。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

18件のコメント返信を残す

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. THANKGOD JONATHAN says

    You have said it all and I will also not recommend changing the WordPress default permalink structure for parent slug. As it is best for both User Experience and SEO.

  3. Ralph says

    I think parent page in url can be useful. I don’t have them on my own website however, when I surf the web i often don’t see a button or menu to go from post to category, so i just delete child url, and can browse parent page. I agree it is more personal than functional, but can be helpful.

    • WPBeginner Support says

      It certainly can be helpful to have them but it is more a question of personal preference for the website owner and the type of content on the site :)

      管理者

  4. Moinuddin Waheed says

    Does it really matter which slug is in the url?
    I mean in terms of search engine optimisation and page visibility in the Google search bots.
    many times we do find it difficult to decide which domain name to get for our blog.
    is it really an search engine optimisation concern for the domain…
    does it matter or we can just purchase any of the domain and start writing our blog content?
    thanks for the nice article about the slug.

    • WPBeginner Support says

      It is a question of personal preference more than a requirement. Some sites want to remove the parent slug for how the content is structured.

      管理者

  5. Ahmed Omar says

    personally I find the parent page in the URL could be useful, as the visitor may just delete the child URL and reach to the parent page where he can find more posts or pages.
    personally I am doing this when I browse sites.

  6. Jiří Vaněk says

    And how will the Google Search Console react if I do this with already indexed URLs? Will it have any negative impact on SEO?

    • WPBeginner Support says

      You would want to redirect the URLs and Search Console would update to the new location over time.

      管理者

      • Jiří Vaněk says

        Ok thanks for your answer. I have a lot of articles on my website and I want to make some changes to the URLs. So, these pieces of advice are very helpful.

  7. Vinay says

    I have changed my page url from education to education-information. But when I click on that page.. it is showing the old page with a message page not found 404 error.. and when click on the page for 2nd time it is going to the concerned page. what should I do?

    • WPBeginner Support says

      You would want to ensure you clear any caching on your site and ensure your redirect is set up properly

      管理者

  8. Chad says

    What about 301 redirects? I recommend setting up these redirects if you update URLs (Google might have indexed the old version of the URL or users may have saved those links).

  9. RS_lyly2009 says

    Awesome post.
    Is there any other way to change the url without installing the plugin?
    Thanks you!

  10. Qasim Yad says

    Awesome! I was looking for this technique for ages. I would really love if you could share any approach other than using a plugin.

    But, still i love this technique. Thanks

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。