Your problem is that your filter is trimming all titles to 7 “words”. This includes blog posts, pages, menu item labels, revision names, and even product names, if you have products.
You need to adjust your filter to be less aggressive and only target the titles that you need to truncate. For example, the following code will only truncate titles:
- For Posts
- In the main loop.
- On the front end.
function wpse_360758_trim_words( $title, $post_id ) {
if ( is_admin() ) {
return $title;
}
if ( in_the_loop() && 'post' === get_post_type( $post_id ) ) {
$title = wp_trim_words( $title, 7, '...' );
}
return $title;
}
add_filter( 'the_title', 'wpse_360758_trim_words', 10, 2 );
Related Posts:
- Generate a tabbed submenu — from taxonomy term or submenu item — with sample content
- Order by menu structure
- Warnings in nav-menu when visiting query pages [closed]
- My Main Query Modification is Messing up my dynamic main – why?
- Set if condition with wp_nav_menu
- Show all data in database table and make it into an interactive table
- parse_tax_query causing Navigation Menu To Disappear
- How to get current page nearest parent id?
- How to get main menu only with wp_nav_menu
- Displaying Pages in Nav Sub-Menu with Specific Taxonomy Terms?
- How do I hide submenus from the top menu bar?
- Calling body_class and wp_nav_menu for a different post
- Show parent’s child and also child’s, child on a page?
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- Wp_redirect and sending variables
- Sanitation needed for WP_Query or get_posts calls?
- how does $wpdb differ to WP_Query?
- WP_Query – filter or directly?
- WP_Query with checkbox meta_query
- replace the WP_Query class in the main query
- How can I save an array from a random post sequence for later use?
- Does WordPress generate an automatic page for post formats?
- Why is WP-Query spelled like it is?
- Limit search results to exact match
- WP_Query hit max joins… How else can I build a search function that uses custom fields?
- Pagination not working Search posts
- How to count data records in wordpress which have same meta_value in wp_postmeta table?
- Order terms inside a select dropdown
- How to speed up wp_query, took more 5s to run against 100k posts
- How to sort posts in admin by titles with dd.mm.yyyy format?
- Why I can’t get old posts instead of recent with WP_Query?
- How get posts from a subcategory of a category by name?
- WP_Query orderby breaks when using AJAX?
- Detect featured image among the attached images
- Exclude old events from WP_Query with date saved in a `meta_key`
- Pass arguments to WP_Query using “set” method
- WP_Query arguments to fetch custom post type posts which are in certain category?
- WP_Query loop within WP_Query loop
- Search Posts with Custom Fields as query
- Use query->set or make new query?
- How to fetch only media that was already attached to a post/page?
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- WP_Query won’t retrieve raw HTML?
- Remove a specific category ID from related post
- Show Sticky Post at the top but do not show again in the loop?
- Any number in meta key (wp query)
- Custom Metabox data slow query on Admin init
- Use Repository Pattern in WP theme
- WordPress Comments sort by custom meta key
- Order by summing multiple values
- Understanding the orderby in WP_Query?
- Need Help For WPQuery
- Out Of memory issue on post per page parameter
- query_vars overriding WP_Query args
- Posts published last 10 minutes
- How should I approach changing the template & $query as part of a shortcode’s execution?
- Exclude All Posts Which Do Not Have A Tag Assigned
- pre_get_posts – Trying to get property of non-object warning
- Replacing search results with custom external query
- Getting additional columns from sql
- get all posts associated with a custom taxonomy
- How to use if($wp_query->query_vars[‘name’] == ‘pagethatdontexist’) without getting a 404? How to suppress 404
- complex get_posts() query to select child pages
- How to add $args to any running wp_query from function.php?
- WP_Query offset is returning post from prevois loop
- Tax query is not working!
- How To Keep Search Title the same on paged Results
- Does WP_Query ‘responds’ badly to empty arguments?
- Get next/prev image/attachment in time with date query
- Reordering content using a meta value
- Adding query parameter to archive page returns 404
- Optimising WP_Query with ACF Fields
- WordPress AJAX Request returns 400
- Using wpdb prepare with a variable, turns it into a big string
- SQL to join u3g_users & u3g_meta_value with repeating data
- WP_Query no result if keyword contains number
- WP_QUERY order posts by two combined meta_value dates
- Order by value of Custom Field using url string
- update_post_meta performance in a loop woocommerce
- How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
- Separate by Category Post Type
- ACF: using two loops, the_field returns field content from another loop
- Combine WP_Query with array of custom data to single loop without breaking the pagination
- query_posts() doesn’t seem to be called in my page
- WP_Query returns empty if meta_query has more than 7 values
- query.php – multiple is_category functions
- Optimising specific Query with ACF meta objects
- How to get several fields from wp_query?
- Overwriting auto-appended NOT IN query in WP_Query
- Pagination not working with WP_Query (creates links but no page)
- WP Query posts__in not working with array
- query_posts with sorting on a custom datestamp
- Conditionals in WP_Query
- Query Posts by date range with fixed beginning and end
- query by meta value then date and not empty meta value
- Is it possible to use WP Query to orderby custom meta value and custom taxonomy?
- Display all custom meta field values from the database using ACF Repeater
- Show number of posts AND number on current page (cannot make it work)
- Advanced Search – Is this possible?
- How to include custom fields in wordpress search