the_title_rss()
outputs its value straight away so it can’t be used in a function like that, you would have to use get_the_title_rss()
Or alternatively the_title_rss() has a filter we can hook in to and return your shortened title is possible. (You would add this to your functions.php)
function gg_short_title_rss($title)
{
// This can return false, so check there is something
$short_title = substr($title, 0, strpos($title, ' –'));
if ($short_title) {
return $short_title;
}
// Else just return the normal title
return $title;
}
add_filter('the_title_rss', 'gg_short_title_rss', 10, 1);
Related Posts:
- Custom field in title
- How to update custom fields using the wp_insert_post() function?
- Display all values of custom a field created with ACF on a page
- Adding custom input for data attribute in insert media modal
- If Custom Field is empty don’t display div
- Custom Meta Field – Youtube embed
- Filter the blog title displayed in the header
- Blank on static home page?
- Print html when custom field has value inside while loop
- Update WordPress Custom Field with AJAX on cached page
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- Customized title tag for each page in pagination?
- how to increase custom post value by one most efficiently?
- Sum custom field values of particular taxonomy
- Importing hard coded custom field into acf field
- Part of title duplicating but not sure how to remove from code – help?
- Passing the custom field values in the wp_get_current_user array function
- Firing schema via code in functions.php doesn’t work
- Applying A Category to Existing Posts Where Page Title Matches Regex
- How can I add extra word in permalink when someone click download button?
- Seach custom post type posts only by meta fields?
- auto-populating custom nav with all items from custom post type
- conditional logic for front-end custom field edits
- Automatic Shortcode Creation with Custom Fields [closed]
- Custom field values to taxonomy terms
- How would an if statement surrounding a custom field with two variables (holding values) look like?
- Which PHP page is the Default Posts Page
- Non-Closing PHP Query in WordPress Loop
- Reduce size of responsive title
- Display custom field on 404 page outside loop
- How to show/hide php table rows based on the content of custom fields
- Only show image from custom field when present
- Hide Heading if ACF Field is empty
- Custom meta box values are not getting saved for my custom post type
- WP_Query: getting posts where custom field exists
- How to show meta value code HTML after x paragraph
- Creating an image from a custom field
- User Meta Value not echoing despite Var_Dump Showing correct string
- WordPress loop by meta key that is an array? and how loop multiple arrays
- WP All Import / Update stock quantity from multiple XML files
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Split site title and apply different classes
- Concatenate Custom Field Value & HTML Value
- Output custom text field as unordered list
- `update_post_meta` not working anymore
- Order a WP_Query by meta value where the value is an array
- Unable to render custom field after attempt to generate a list of recent post in page template
- Add a custom class to the body tag using custom fields
- Hide a div when a custom field is empty
- Conditional On custom field plugin metabox
- Filter unique custom field value based on custom taxonomy category or other custom field
- Meta boxes only displayed when editing normal (default wp post_type) posts
- WordPress stripping out custom field tags
- Can ‘Custom Field’ data be inserted into this Short Code?
- Using an “IF” statement based on the existence of custom field
- Query pulling a single post per month
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- Updating Metadata with Shortcode
- Set document title through shortcode plugin
- Adding a custom meta field with default NULL value which is not selectable
- How do you save the values from custom fields to a products data
- Products listing check if meta checkbox is checked
- Is it possible to update the dataset using update_post_meta
- How to update custom fields when post is published?
- Hide a div if the fiels is empty
- Setting up a cron job to auto update a custom field
- Inserting a class on before_widget if checkbox is checked
- Time Stamp In A WordPress Post Title That Does Not Keep Refreshing
- What is the correct way to search 3 custom fields only in WordPress?
- wp_get_nav_menu_items() with ACF
- How can I get the custom post title?
- How do I get the value of a current user’s custom field?
- Trying to retrieve meta values from three different meta keys and display in rows
- Site title not showing. Please help me
- WP post meta – for loop inside for loop
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- WooCommerce multiple custom fields code
- Allowing HTML elements in title widgets spacing problem
- WP_query meta_query slow with OR and DATES
- Get meta_query value by user meta array
- meta field for numerous links
- Include a custom field in mysql query
- Display Content Based on Custom Field Value
- my site show this symbol (::) between site title and tagline
- Display tab title as ‘blog tagline | blog title’
- divide custom field values in div every two values
- Showing custom field contents without listing description
- How to exclude post from being queried based on custom meta value
- How to link a word comprised of a custom field with another?
- How can I put a custom field as the link of a button shortcode?
- Posts sortable column not sorting properly for custom field numbers
- Hide page title
- Search result page – display values from the result’s metaboxes
- ACF Date fileds to Age Convert [closed]
- Save custom field value to variable for conditional – why is this not working? [closed]
- Grabbing value of input field inside of array
- Convert custom field date format to “WordPress default”
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress
- How to execute a shortcode within a custom field?