Icon Request Website Quote

To rename the page tabs by condition in WordPress, you can use a conditional statement in your theme’s functions.php file or via a custom plugin. Here’s a simple method using PHP:

Steps:

1. Open functions.php
Go to your theme folder (wp-content/themes/your-theme) and open functions.php.

2. Add Conditional Title Filter
Add the following code:

php

add_filter('the_title', 'custom_rename_page_title', 10, 2);

function custom_rename_page_title($title, $post_id) {

// Only apply to pages

if (is_admin() || !is_page()) {

return $title;

}

// Example: Rename “About Us” page title if user is logged in

if ($post_id == 42 && is_user_logged_in()) { // Replace 42 with your page ID

return ‘Welcome Back!’;

}

return $title;

}

🔁 You can change the conditions using:

  • is_user_logged_in()

  • is_page('slug') or by ID

  • is_mobile() (with plugin)

  • Any custom logic

3. Save & Test
Reload the page on your site to see the new tab name (usually shown in browser tabs as the page title).

Optional: Change <title> Tag (SEO/browser tab)

To change the browser tab text (not just the visible title), hook into wp_title or document_title_parts:

php

add_filter('document_title_parts', 'custom_browser_tab_title');

function custom_browser_tab_title($title) {

if (is_page(42) && is_user_logged_in()) {

$title[‘title’] = ‘Welcome Back!’;

}

return $title;

}