There are a lot of things that can be improved in the code, like the use of global
variables, but Im guessing you are learning so I’ll answer your question first.
You can try this technique to alter the title only in the page, keeping the menu intact.
Basically
Go to Appearance -> Menus and your menu item. Here you will see the changed page title. In order to keep the old menu name, open this menu and type it under the navigation label and click Save
Also consider reading this for the correct use of the global
keyboard
Related Posts:
- How do I hide the current page’s title?
- Include a page template along with add_theme_support()
- Remove “Private” + “:” in title does not work
- Changing document title only on a custom page template
- How Can I Have A URL Changed Based on the Originating URL?
- get_title without filter(the_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
- Don’t see add_filter result in the site front page
- Access get_the_title() from ‘excerpt_length’ filter
- How do I hide tinymce within the edit screen of a particular page
- Shorten the title length
- Strip $before & $after strings from a page title
- Filter the title to only affect the_title() template function
- Modify WordPress Page Title ()
- 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
- How to filter users on admin users page by custom meta field?
- How can I add an Author filter to the Media Library?
- Modify WordPress Rest Api Request/Response
- How to add some custom HTML into wordpress admin bar?
- Add wrapper to only youtube videos via embed_oembed_html filter function
- Hook into admin post list page
- Add post/page ID to inserted links within the_content
- How to exclude/filter a tag from get_the_tag_list()
- Ajax, filters and shortcodes
- Filter the blog’s title without using global variables
- Multiple Ajax Data Action
- user_has_cap filter allows edit but will not allow save
- Changing a WordPress core function without hacking core
- Change WordPress RSS link with filter?
- How to remove get_post_metadata using remove_filter inside a class?
- where to apply “apply filters” and other Sanitization Functions
- Add guid filter to attachment in media library grid mode
- Sorting and limitation with pre_get_posts
- Warning: Missing argument 2 for widget_title filter
- Change term name only on front
- Change name of existing post status type
- add_filter(‘the_content’, ‘…’) stops pagination from working
- Header image automatically changes depending on season
- How to remove SKU’s from ALL products in Quick View – already remove from each product page
- How to hide Ads in between posts on AMP? [closed]
- What is the downside of using a filter as a “poor man’s” dependency injection?
- BBPress changing default group activity
- How can I change the language of automated Mails?
- How can I replace an oEmbed URL in post with actual embed HTML
- Filter the_content to add something before each element?
- Replacing a deprecated filter ‘woocommerce_get_price’ with ‘woocommerce_product_get_price’
- How do you get specific tags from the_content?
- Add a filter inside an action init
- Filter by category and city for doctors and hospitals in wordpress
- Using add_filter to prepend content, result is out of order
- Why is overwriting $GLOBALS killing the_content()?
- Sorting products by price ( regular + sale price )
- get_posts() interrupt because of filter
- Create new custom field that calculates age
- Remove comments validation (remove filter?)
- How to query if meta_key does exist or not?
- Disable sanitize_file_name on upload without modifying functions.php
- Remove Site Name from wp_title WITHOUT removing from attribute
- Plugin default settings hook
- How to get changed post title in my custom plug-in which fires when ‘save_post’ is called?
- add_filter to the_content after apply_filters
- How to filter with dropdown in backend for custom data
- Is there any reason for the nested filters to be applied on the first case and not in the second one?
- Best practice: Custom Post Type / Filter / Load more
- How to Edit Ecommerce filters URL, h1, h2 , Title
- Redirect an archive page to its relevant URL-friendly filtered page
- How to modify image caption in posts?
- Show uploaded pdf files dynamically and filter by month name
- how to use substr with get_the_content()
- AJAX Post Filter
- Mystery line break
- Consult array data in REST API Filter
- How to add markup to the wp-custom-header div
- How to take shortcode and content separately from a page?
- Display post after choice two taxonomy terms
- How to stop echoing gallery inside content?
- Having issue with dynamic data within restrict_manage_posts function
- how to filter datalist table of wordpress
- Ajax Filtering Pagination
- Custom permalink for attachment
- Overriding Generated Attachment Post URL
- Print url to default featured image
- How to filter wp_get_recent_posts() to only posts that have thumbnails?
- Adding user filter – Not updating data in URL
- How to check which submission button was clicked?
- filter wptexturize doesn’t work on old posts titles
- remove_action conditionally for Custom Post Type – not working
- Custom Filter using meta_value in wordpress admin list not working
- wp_get_attachment_link filter not working
- How would I remove an inline googleAPI font script in the the parent theme header.php?
- Getting entry ID from frm_email_message filter in formidable
- Is there a hook or filter that adds a button to the left of the search box?
- filter a list by gender
- Replacing text using add_filter
- Background color and background image below element in Contact Form 7 – error tip [closed]
- Change password reqts with NO plugin without breaking resetpass link?
- How can I conditionally add the filter option_home?