如何移除WordPress页面标题中的"homepage"字样?
Fixing the "homepage" Text in Your WordPress Page Title
Hey there! Let’s get rid of that unwanted "homepage" text cluttering up your site’s page title. Here are the most common ways to fix this, depending on how your WordPress setup is configured:
1. Check Your Theme’s Customizer First
Most modern themes let you tweak page titles directly in the Customizer—no code needed:
- Head to Appearance > Customize in your WordPress dashboard.
- Hunt for sections like Site Identity, Header Settings, or SEO & Social (names vary by theme, so don’t be afraid to poke around a bit).
- Look for fields labeled "Homepage Title" or "Frontpage Title"—you’ll likely find the "homepage" text here that you can delete or rewrite.
- Hit Publish to save your changes once you’re done!
2. Adjust Your SEO Plugin Settings
If you use an SEO tool like Yoast SEO or Rank Math, they often take control of page titles:
- Yoast SEO: Go to SEO > Search Appearance > Homepage. Edit the "Homepage title" field to remove the "homepage" text, then save.
- Rank Math: Navigate to Rank Math > Titles & Meta > Homepage. Tweak the title template to erase any mention of "homepage" and update your settings.
3. Use a Custom Filter (For Code-Savvy Folks)
If the above methods don’t work, you can add a small code snippet to target the title directly. Use a child theme or a code snippet plugin (like Code Snippets) to avoid losing changes when your theme updates:
add_filter( 'wp_title', 'remove_homepage_from_title', 10, 2 ); function remove_homepage_from_title( $title, $sep ) { // Only target the homepage if ( is_front_page() ) { // Remove "homepage" (case-insensitive) $title = preg_replace( '/\bhomepage\b/i', '', $title ); // Clean up any extra spaces left behind $title = trim( str_replace( $sep . ' ', $sep . ' ', $title ) ); } return $title; }
4. Double-Check Your Static Homepage Settings
If you’ve set a specific page as your homepage:
- Go to Pages > All Pages and edit your homepage.
- Look in the right-hand Document sidebar for a SEO Title field (added by your theme/plugin) or the default page Title field. If "homepage" is in either, edit it out.
- Update the page and refresh your site to see the change.
内容的提问来源于stack exchange,提问作者Software Engineer
相关产品推荐
相关产品推荐

