Here’s the hacky way I figured it out:
if ( preg_match( '/<!--more-->/', $post->post_content ) ) {
$content = apply_filters( 'the_content', get_the_content( '' ) );
echo ( $content );
} else {
the_excerpt();
}
(Note that I have a separate “Read More” link after this snippet; if you’re wanting to use The Content’s default Read More link, remove the space from get_the_content();.
Related Posts:
- Filter Post Title without affecting screen-reader-text
- Read More in the actual excerpt
- Get excerpt from $post->post_content
- How to use the_excerpt in a filter hook?
- add_filter on “the_excerpt” only works when post does not have excerpt
- End excerpt at the end of the sentence
- get_the_excerpt() with fallback like the_excerpt()
- Exclude filter on front page
- How do I filter get_the_excerpt() but keep all of its functionality intact?
- Buddypress: Edit activity when new blog post [closed]
- How to make a button?
- Why in archive page doesn´t show read more button with excerpt?
- the_excerpt filter with an empty excerpt
- Access get_the_title() from ‘excerpt_length’ filter
- How do I override the_excerpt so that it will display full content?
- the_excerpt filter doesn’t work as expected
- Excerpt is being added above the content, but it should be after it
- run shortcode in excerpt of single custom post type
- apply_filters(‘get_the_content’, $content) + Except
- Trimming a custom field to a length
- Prepending character(s) to a custom tag title?
- Adding html banner to posts
- Apply wordpress filter checking category
- Add Filter – Pass Variable (PHP < 5.3)
- Create different flavours of excerpt
- Cutting off excerpt with first sentence
- Auto-generated excerpt with shortcode and read more button/text link
- is_page_template() doesn’t work with excerpt_length filter
- the_excerpt() does not work with has_excerpt()?
- get_the_excerpt on mobile still displays continue reading
- Can’t change excerpt length and more tag
- Custom excerpt_more filter not working when tag is present
- Why does using excerpt_more filter change link location?
- Only show read more text when when wp:post-excerpt meets excerptLength
- Not able to change wp_title using add_filter
- How to hook a filter to catch get_post_meta when alternate a custom field output?
- Changing JPEG compression depending on image size
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- Insert Custom HTML After Shortcode
- Is there a way to add another row to the tinyMCE kitchen sink toggle?
- add_filter to youtube embeds?
- How can I detect if a user changes their password?
- SSL certificate for the host could not be verified
- Store source permalink on XMLRPC calls
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- WordPress RSS feed – filter RSS content by custom field value
- What is the filter hook for custom fields content?
- Filter keywords from search query
- Add class to woocommerce checkout body based on filter [closed]
- changing variable through filters or action hooks
- Changing Gutenberg / WP block editor width only on pages, not posts or other taxonomies
- How to replace any occurence of Gravatars with a local placeholder image?
- Ignore dots when searching in the media library?
- How To Get User Data in Callback Function for pre_user_nicename?
- What’s the best way to split admin-only functionality in the theme’s functions.php file?
- Which built-in WordPress files are safe to edit?
- Why won’t my preg_replace work with content_save_pre?
- How do I target a single page to modify the comment form of only that page?
- How Does comment_author Filter Work?
- Contact Form 7 filter similar to preprocess_comment [closed]
- Walker_Nav_Menu doesn’t work in wp_page_menu_args filter
- get_posts() and filters
- upload_files cap to not loggen in users – add_cap to not logged in users
- How to customize the “Insert/edit link” popup box?
- How to filter backend post list showing only posts having a shortcode
- new_excerpt_more link not working properly
- Add Lightbox To WordPress Native Gallery
- Get current user data
- get_post() containing gallery is outputting an unmatched closing div at the end of the content
- How to add attributes to WordPress Admin Sub Menu List Items
- How do I hook my function to run only after submitting login form
- How to write a filter to remove a form field (WordPress) [closed]
- Why doesn’t this function work when I know that the IP Address is “true”?
- Map plugin with proximity search compatible with Buddypress
- Create a pre-filtered version of the Media Library
- How to filter Sidebar Content
- Removing URL and adding container around image in the featured image metabox
- How would I use a filter to remove header banner on certain post types
- What are the steps + prerequisites for using an add_filter?
- an action hook when a post reaches a certain number of views
- Excluding posts by meta, and also keeping posts without the meta
- Replace Data In Post & Update Meta Field Post Is Saved
- How to add custom media library mime icons?
- Customising the default wordpress search functionality
- get_post() with filters applied
- Ajax filter – show all results that contain at least one filter
- WP_Query filter by custom meta
- How to add a blog filter bar without paying money. (example inside)
- Override admin selected page layout
- WordPress: Issue with filtering users using date range
- Does anybody know what the $current_screen ->id for customizer.php is?
- wordpress filtering out caps in wp_title? (UpperCase is changed to Uppercase)
- What scope is $blog_url = get_bloginfo() inside a function
- Turn wp_tag_cloud into a front-end filter
- get_posts displaying wrong permalink for “continue reading” link
- Add HTML to Page Content
- How can I define the RSS feed content length?
- Filter dashboard custom post listing by user
- Is there a way to override only a portion of the function print_media_templates defined in wp-includes\media-template.php?
- How to override hook from themes functions.php which is defined in plugin