Use the wp_title
filter, which passes the current title, separator, and location as arguments. It then appends the custom field value to the title if the conditions are meet. For more details :- Visit Link wp_title
function wpse_224340_document_title($title, $sep, $seplocation) {
global $post;
// make sure the post object is available to us
if (is_singular('mec-events')) { // check we're on a single post
$release_author = get_post_meta($post->ID, 'mec_fields_2', true);
if ($release_author !== "") {
$title .= " (" . $release_author . ")";
}
}
return $title;
}
add_filter('wp_title', 'wpse_224340_document_title', 10, 3);
Related Posts:
- How to create shortcode to display custom field value on a custom post type
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- How to render a custom post type template with custom fields using shortcode
- Add custom attributes to a post
- How to call a post’s metadata in shortcode.php?
- Alike Shortcode using in Custom Shortcode
- Custom Info Box at end of posts?
- Create shortcode for list of custom post titles with custom fields alongside
- Advanced search form with filters for custom taxonomies and custom fields
- Help Creating a Slideshow Custom Post Type with Custom Meta Boxes?
- Search multiple custom fields by using meta_query
- Custom Post Type – Taxonomy Dropdown Menu?
- How do I implement custom fields without using any plugins?
- How I check if the same post slug has not been used before publishing?
- How to sort a table of custom posts by column containing custom field
- Issue with saving custom post type when editor is removed
- convert Custom Fields Option-Values to Tags/Taxonomy
- Custom post metadata not appearing in public API
- Automatically Insert Custom Field on Custom Post Type Publish
- IF statement in a do_shortcode
- Display custom post types with custom date field value (before today) & order by custom date field
- How to have the right design for a custom post type without accessing themes
- Create a post in custom post type using field in registration form after users submit form
- WordPress custom meta field for custom post not storing data
- Conditional regex in add_rewrite_rule() for specific query filters & pagination
- List all images from a single post meta value
- Publish an XML feed from a CPT with ACF fields?
- How to enable shortcodes in a custom post type?
- WP_Query: include custom post type only with specific meta value
- Is there a way to get a file URL from the relationship ACF field?
- Get custom fields from a custom post type with a shortcode
- Meta Key Value in current-user-only loop
- How can I dynamically add a post to a custom post type which uses a custom field?
- dynamically add a custom field or metabox to custom post type [duplicate]
- How to implement a Google map store locator
- Random image from tag/custom type on sidebar
- retrieve Meta field value from CPT and set those values as Image Meta Field “Title”
- Set a maxlength for the title input in a custom post type
- Update Post Meta for a logged in user
- Problem querying Custom post type by custom fields
- Using custom field content as expression in IF statement [closed]
- ACF From & To Date Validations
- Query Multiple Custom Posts by Custom Fields
- Custom REST endpoints for a custom post type with custom fields
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Meta Query posts not showing on ending date of custom field
- Cross reference custom post types
- frontend image post uploader
- Possible to filter custom post type with multiple meta data?
- Show fields based on taxonomy selection in editor
- Permalinks: custom structure for taxonomy – tags?
- How to Get the title of a custom field?
- How to retrieve category of a post in have_post loop?
- How to customize work area / admin area in a custom post type without plugins?
- ACF in wordpress
- delete_post_meta() for whole CPT / multiple posts?
- How to inherit field value from parent post into in child / sub post
- hide specific div on single.php [closed]
- How to get_term_meta on single custom post?
- How do you output an unknown number of images in a custom post type with desired markup?
- Filter content in shortcode
- How to fetch custom post types with its full data on wordpress?
- Shortcode with WP_Query more than once on one page
- Custom Fields not showing up for custom post type
- Custom post type in Custom widget – $listItem
- Generating and downloading files with WP API
- Problems making shortcode with custom post types and taxonomy
- Add a class to post_class if more than one post shares same meta_value_num
- Add a meta field to the list of results for a custom post type
- Front-end Image Upload to Custom Meta Box
- How do I list a custom field and custom taxonomies for each result in a loop?
- How to make post templates to include shortcodes only?
- Custom fields for post or terms which don’t update on post update
- Query custom post type that has a serialized relational advanced custom field value
- Updating a custom post status after an expiry date rather than trashing it
- How can I query and sort custom-post type using WP_Query
- Meta query and compare “!=” not working as expected
- WordPress shortcode to pull product post data
- How to add dynamic fields on wordpress custom post type page in admin section
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Run query on specific admin options page and send results to select field in another function
- get_previous_post_link and get_next_post_link of custom post type that share custom field value
- Extracting Post ID and passing through as an attribute in a shortcode
- Automatically assign posts with custom field to taxonomy term
- Attach several custom posts to one meta field
- Error in WP Query. If variable is empty it is displaying previous post value
- Show first posts with custom field not empty and order all by title
- Modify shortcode to work with custom taxonomies and slugs
- Shortcodes in custom post fields without the_content()
- Order by custom field attribute
- Echo custom field value
- Custom post type and custom taxonomy archive inaccessible
- Rewriting a page driven by custom fields to populate a page dynamically, like posts
- Calling Custom Post Meta
- Navigation links to posts in current term shortcode
- add comments custom fields after user is logged in
- How do I add a new field/meta box to the Custom Post Type Portfolio in the Kaboodle Wootheme?
- How to loop through a custom post type using a shortcode and output each element in the loop using shortcodes
- Get Posts ordered by a date custom meta field
- One WP website as content source for several others