You could write a function to hook into the display of the title, and then when the title is displayed, it will get the value of the custom field and append it to the title. That way you aren’t editing/changing the title every time you save the post.
You could do something like:
function append_year( $title ) {
global $post;
$terms = wp_get_post_terms( $post->ID, 'release-year', array("fields" => "names") );
if ( count( $terms ) ) {
return $title . '(' . $terms[0] . ')';
} else {
return $title;
}
}
add_filter( 'the_title', array($this, 'append_title' ) );
wp_get_post_terms
returns an array, and you can pass it an array of args to configure what you want see the wp_get_post_terms documentation.
The code above was adapted from this other SO post about appending title text
Related Posts:
- How to add a theme custom variable to a post title?
- Title and post URL based on custom fields?
- Split the_title
- How can I modify RSS item titles to be either the title or a custom meta field?
- Shortcode To Display Post Custom Field Value in Post Title, Post Content
- How to I make my post title link to a custom field
- Best way to achieve multiple links in a post title
- Move the post title to another field
- Decouple page name from page title
- WP Query Args – search by meta_key or title
- Remove Dimension from wp_get_attachment_image
- Is there a way to get protected meta fields through any of the available built-in WordPress APIs? (xmlrpc, wp-json)
- add meta box – custom field : which to choose?
- How to use custom fields in post title?
- Custom fields PHP foreach loop
- Show links to archive pages based on custom field values
- Storing meta fields multiple times OR once with multi dimensional array?
- Date, Time, and Timezones
- Add custom option to Standard Page Attributes Meta Box
- Call a custom field in an audio shortcode?
- checkbox in post add/edit to add/remove the post from menu
- Custom Fields Bulk Edit
- Custom Page Template [closed]
- Using OR in WP_Query negates the “NOT EXISTS” compare
- How to add a predefined custom field without using a plugin?
- PODS performance vs custom field
- Custom Fields with get_post()
- How do you create dynamic customised sections in WordPress?
- How to enable Custom Fields that are disabled by theme?
- Calling custom fields for pages (not posts)
- how can i stop custom fields that have apostrophes from breaking my code
- How to add field above password section in profile page
- How can I store a file in the database in the same way WordPress and ACF do?
- Create new post with meta data using WordPress API
- Custom Field Create Bulk via SQL Query
- get_terms that have custom sticky field checked
- Should custom meta boxes be able to output shortcodes the same as WordPress’ native post editor?
- WPML & CFT: keeping custom field file to translation
- How to make condition, based on custom fields value?
- How do I Implement Atomic Update of Post Metadata?
- Custom fields value
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- Want to make A CSS if meta key value is empty
- Add & store extra fields – WordPress Comments
- More efficient to add content to custom fields or the content area?
- Custom field query without duplicates results
- Outputing a metabox textarea and avoid line breaks inside li tags
- Restrict WordPress Search to Custom Field
- how to display an excerpt of the latest post on the homepage?
- How to add a custom field to a post created programmatically?
- How to mass update custom fields for more than 20k posts
- querying a custom field
- Custom post type missing custom fields
- Problem with saving large amount of data in postmeta/usermeta
- How to get posts with a metadata numeric key greater than X?
- List all unique custom field values?
- meta_value and meta_key filtering returning no posts [closed]
- “Matching” or “Linking” Two WordPress Pages: Custom Fields?
- Build index page from custom fields
- Meta_query ‘compare’ => ‘LIKE’ not working?
- Get text from user and display it on page
- Upload & include specific JavaScript files for posts?
- If metabox has content display content
- Custom meta boxes not saving
- help for user login
- How to change permalink on headlines in rss feeds?
- Listing the most popular 8 city (custom fields) as used in posts
- How to delete file uploaded by Plupload
- Display Meta Data with HTML?
- How to store meta field values
- Displaying custom field meta within WP_query loop
- Order by custom date field
- Group Posts By Custom Meta Value: Date
- Meta field bulk editing no longer working in WP 6.0 [closed]
- Custom Field: how to save array of multiple key-values in WordPress
- How can I detect user’s timezone?
- ACF field group not showing in page
- get_field values for each post on home page using wp_add_inline_style
- Delete user meta but only if found in array
- Custom field in media library not saving, selected() function not adding “selected” to select list input type
- Is there a way to determine which user changed a custom field (and when)?
- Metabox/Custom fields are not saving input data
- meta_query to check all custom fields
- Showing the post only when there is title, thumbnail and the content in Custom Fields
- to create a custom post type with additionnal url field such as link to social network and an email field
- Query Multiple meta
- Show message if statement is false – foreach
- Order by custom field in query multiple
- Returning website screenshot based on Custom Field
- Echo text if field under user_meta is empty with get_users()
- Filtering posts by WORD in custom field
- Cannot Hide Google Map if custom field is blank
- Dynamically update Custom Fields to display new dates
- Add fields to edit in custom widget
- save all acf options in one meta_value [closed]
- Can running a WP-Cron to update_post_meta cause performance issues?
- custom field value is blank or empty
- How to add a custom field to the comments “Quick Edit” screen?
- Multiple triggers when publishing, saving or updating a post in WordPress
- If possible a field ID transfom in a Custom Field?