Please put below code in your functions.php file. You will need to create custom field named ‘custom_post_name’ and set the custom field text to what you want to add to page title.
function alter_page_title(){
global $post;
$current_page_title = $post->post_title;
/* Check if lower case version of current page title is = online exams. */
if (strtolower($current_page_title) == "online exams"){
/* If yes then get value of custom_post_name meta field and add that to beginning of title & return */
$custom_title_to_append = get_post_meta($post->ID, custom_post_name, true);
return $custom_title_to_append. " ".$current_page_title;
} else {
/* else return title as is */
return $post->post_title;
}
}
add_action('the_title', 'alter_page_title');
Related Posts:
- Archive permalinks
- Permalinks for WooCommerce Categories and Subcategories
- Rewrite url / permalink for default archive – yearly / monthly
- Change of permalink structure – redirects in htaccess breaks the archive links
- Custom permalink for search and pagination
- Programatically changing post’s permalink when identical post type is published
- Date Archives’ Permalinks under Category folder
- Can’t select blog month within archive category
- Advanced author permalinks
- Disable date based archives for all categories except one
- Path to Pages Resolves to Archive instead of Actual Content
- permalinks issue and archives
- Change permalink structure for pagination only
- Strip subcategory base from URL
- archive by year and category: permalink support doesn’t work on pagination
- Customize URL for specific tags archive
- Permalinks – Archives
- WordPress Archives Cause Looping
- Permalink, links a page to the homepage
- Permalinks of archive tag wordpress
- WordPress archive posts returns user to homepage
- Post archive pages bringing me to a 404 page
- Strip category base from URL?
- WordPress slug issue with non-latin characters
- Change author permalink
- How to custom change author base without $this->front?
- Change permalinks structure for specific category
- Is It A Good Idea To Change Author Slug (user_nicename field) Directly In MySQL DB?
- Custom post type by ID in root folder
- Permalinks Question: Adding a prefix ONLY in front of the posts
- Permalink redirection from ‘Day and name’ to ‘Post name’
- Create slugs programmatically
- How to Remove -14 from WordPress URL (Permalink)
- Rewrite URL Parameter And Force ‘Pretty’ Permalink
- How to map a URL to a specific template?
- How to hook into permalink when publishing-saving post?
- Problem duplicated shortlinks bitly
- Incorrect 404 for pages when using permalink, a static front page, and posts page
- Multisite Network: How to change permalink structure programmatically on new blogs
- Custom Permalinks don’t work on local LAMP installation
- Problems redirecting to “pretty” permalinks (wordpress in Subdirectory)
- Remove permalink settings in post for users
- Remove multisite “blog” slug from specific custom post type
- Redirect parent taxonomy to it’s child
- WordPress Permalinks still not working despite all necessary settings
- RewriteRule accepts numbers but not letters in tag
- Avoid WordPress categorizing a permalink request as Not found 404 Page
- Pages not using permalink
- Redirects after permalink change
- WordPress permalink setup in Hindi
- Remove -2 from URL; no duplicate pages, no images, no pages in trash
- Process all virtual sub pages on parent page
- Custom permalink with two parameters
- Permalinks settings
- Changing permalinks structure without loosing SEO
- Change Structure Permalink => Error 404? How to redirect
- how do links move when I move my site?
- Permalink for specific page name
- Comment author url link is wrong? How to change from authors/ to author/
- Direct link to post when multiple categories are selected
- Make custom post available under main domain directly?
- Getting an ID from a URL, why can WP do this itself, but none of of the functions provided get it right?
- Add variables to all permalinks in site
- Big arabic permalinks not work
- How to add post meta to post permalink with still keeping a good performance?
- Page Navigation is not working with permalink structure
- Page URL not working due to physical directory
- Gutenberg Editor: dynamically edit slug field based on ACF field
- Cannot Set Custom Permalinks for Multisite Post Migration
- Load-balanced site frequently losing permalink settings
- Problems fixing a REST API 404 after Moving my WordPress Directory and updating Permalink Structure
- Redirect page to homepage, keeping URL
- Internal forward link with add_rewrite_rule
- Adding query string to multiple page urls in a WordPress function
- Change permalink structure with post id
- How to allow different authors to use same post slug?
- How to display category and subcategory in wordpress permalink structure?
- Updates all internal links on permalink update
- What permastrusture tags are generated out of the box right after creating custom post types and taxonomies?
- Generate post title and permalink from custom field and post date
- Permalink Options does not change
- The permalink for the page doesn’t work and page’s defined link throws “Object not found!”
- WordPress search seems to look into permalink (which is bad)
- whats is the perfect configuration to .htaccess for permalinks?
- Select page/template from the permalink url
- localization for Permalink
- Permalink / sub-template issue
- Use shortlink as permalink
- Mystery ghost page not appearing in Admin
- Update permalinks after domain change
- Comparing permalink to url
- 404 not found error on WordPress local host
- .htaccess regex for redirect subdomain to root domain & redirect old permalinks
- Lists Top Authors by Most Recent Posts
- ugly URLs appear as 404 in GWT
- Category archive page has two URLs even when default theme is active with no active plugins
- UI does not show correct Slug after modified using save_post action
- Non english characters in search bar
- How to set custom permalink in WordPress for single post in single directory?
- Blog URL Structure – Multiple Taxonomies