I think you will want to use the wp_title
filter. Add the following to functions.php
:
function wpse62415_filter_wp_title( $title ) {
// Return a custom document title for
// the boat details custom page template
if ( is_page_template( 'boatDetails.php' ) ) {
return 'I\'m the boat details page';
}
// Otherwise, don't modify the document title
return $title;
}
add_filter( 'wp_title', 'wpse62415_filter_wp_title' );
Make no other changes anywhere, including in header.php
.
Related Posts:
- Remove description from on Home
- Include a page template along with add_theme_support()
- Filter Widget Title Wrap
- Don’t replace “|” with Empty String (“”) when generating slugs from title
- Anyway to edit the titlebar of WordPress Widgets in the Admin area?
- Alter only the page title, not the post titles within
- Filtering ‘the_title’ with option to return subhead?
- wp_title() empty on a static front page
- Can’t change the title tag with wp_title filter
- How Can I Have A URL Changed Based on the Originating URL?
- Setting title using wp_title filter
- Add a Span Around a Product Title in WooCommerce [closed]
- Wrap h1-h6 in a div
- Variables in post title
- How do I hide the current page’s title?
- Is it possible to use multiple spaces in title?
- WP action/filter to modify title before header output and article output?
- Create Page Template by hook programatically in Functions.php in WP 5.8.1
- Filter media upload attachment meta
- Use of comment_reply_link_args filter
- Filter page title (displayed in browser tab) of wp-login
- How do I hide tinymce within the edit screen of a particular page
- Strip $before & $after strings from a page title
- add_filter( ‘the_title’ gets through this if statement twice
- Filter Post Title without affecting screen-reader-text
- Modify WordPress Page Title ()
- How to filter page title for certain page?
- get_the_archive_title hook unwanted changes!
- Adding Filter | Page Title | Template | Why the_title affecting on menu?
- What action/filter can be used for modifying the page to be rendered?
- Remove action added from class
- Hide H1 Title using the_title filter
- Admin filter/error if post title is too long
- Auto append text after the title?
- How to hook a filter to catch get_post_meta when alternate a custom field output?
- Changing JPEG compression depending on image size
- How to add headers to outgoing email?
- LESS CSS enqueue_style with add_filter to change rel attribute
- Remove Editor From Homepage
- Insert Custom HTML After Shortcode
- Is there a way to add another row to the tinyMCE kitchen sink toggle?
- add_filter to youtube embeds?
- How can I detect if a user changes their password?
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- Add Dropdown menu using “add_filter => wp_nav_menu_items”
- Restrict filter to run only inside specific function
- How to add a custom filter in functions.php
- How apply_filters work in WordPress?
- “Maximum function nesting level of ‘100’ reached” after adding a new filter
- What functions are included in apply_filter(‘the_content’)
- Are there Limitations on filter handles?
- Hide content editor for posts after approriate date
- Buddypress: Edit activity when new blog post [closed]
- How to make a button?
- Same Conditionals Not Working on Two Different Hooks
- Filter get_template_part() $args array
- Modify a Filters Second Parameter
- How to edit dashboard search posts button texts for my CPT?
- Insert term when page is published – avoid duplicates after edits
- Filter Media by Featured on Admin
- Capture post content before page renders
- Empty string supplied as input when parsing content
- How can I run this code once so that my generated post title doesn’t keep changing on publish/update?
- How can I remove the kses filters when saving a specific post type ? (it breaks my JSON)
- Remove_action does not work
- How to access plugin variables from theme templates without using globals?
- WooCommerce Custom Product Validation [closed]
- Make WP not format code, not insert line breaks in between tags
- add img class to native wordpress galleries
- Get Posts updated or published within the last x hours
- Missing Argument 2 for apply_filter
- How to get a single hook from wp_head()?
- WP filter to alter admin CSS styles?
- preview_post_link for Custom Post Types
- Why this filter hook is not working when passing parameters?
- Is it possible to bind a function to a filter hook via Ajax?
- Change the template when the user is not logged in using page_template filter (it does not work)
- Regarding post text filtering
- How to Prevent WordPress to encode html in post?
- Filter posts by meta data using custom query
- Which Filter Do I Use To Modify The Subject Of The Retrieve Password Notification Email?
- Register users by e-mail
- automatic title through filter
- Filter causing loss of _wp_attachment_metadata
- Action hook to control access to certain parts of my site
- How can I tranlslate post date in italian?
- Use alternative front page if cookie is set
- Having wp-admin on different domain
- Use a functions in functions.php to remove a string for template theme
- how to output HTML tags in post_content and not as plain text
- oembed_dataparse filter not running at all for standard YouTube embed
- Add filter conditionally to a page
- shortcode function outputs multiple anchor tags
- Show child theme for users on specific IP
- wp.getPosts with status = ‘trash’ using node.js
- Custom field in title
- Adding an orderby filter, casting postmeta with multiple keys
- Identify admin/logout and more filters
- How to create a list of terms who’s posts also have a predefined external term?
- How to change this WP logo and posts url in block editor?