So we already resolved the issue via the comments, but I thought I should explain something:
has_excerpt()
returns ! empty( $post->post_excerpt )
if the post has a custom/manual excerpt, so if the function is returning true when it should be false, then it’s likely because the length of the excerpt in the database is > 0, e.g. when the value is a whitespace — empty( ' ' )
= false. (But note that empty( '0' )
or empty( 0 )
is true)
So if that’s the case, then you should fix the post_excerpt
value in the database so that the function returns the expected value.
But as I said in the comment, I’m not sure why the excerpt was imported with all that whitespace, so I could only guess they were added during export or maybe the import, via a filter.
Anyway, I hope this answer helps! 🙂
Related Posts:
- $WP_Query: How to display excerpt on first post only
- How to split a post and intercalate elements from a loop
- Display specific page (that is child) content on parent page
- Why is get_the_excerpt returning full content
- Why does apply_filters behave different inside and outside a loop?
- the_excerpt() not working in custom archive
- Get post count of current loop when using multiple queries on one page
- How can i display the content in plaintext
- Display products from specific category in shop page
- get_template_part in for loop
- “pre_get_posts” firing on every query
- Show two random posts from custom post type
- Sort posts by custom taxonomy name
- Loop inside the loop
- Looping through tabular data
- Show default content if custom WP_Query has no posts
- cloning a WP_Query
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Display featured products through custom loop in WooCommerce 3 [closed]
- meta_query on a date range using an array of values
- How is WP_Query connected to WP_Post in The Loop?
- Remove ellipsis from the excerpt retrieved using get_the_excerpt()
- the_excerpt(), get_the_excerpt() and the_content() all killing “the Loop”
- Multiple WP_Query loops with Pagination Not Working
- WooCommerce Only OnSale Products Loop Snippet [closed]
- Apply CSS class to every second database record [closed]
- How to prevent writing duplicate loops?
- ACF – Get lowest & highest value from field
- query user display_name failed in a custom mysql query foreach
- How to find a post id using the post_excerpt?
- Query posts by specific word on title
- Multiple taxonomy And acf filter group by
- Reset postdata to custom query in nested queries
- How to Filter Posts by Custom Fields?
- WP_Query condition affects posts_per_page count
- Custom Search Not Consistent with Results
- Display both standard posts in a specific category along with a custom post type in a single loop?
- Orderby is working with one query but not with other
- 1/3 of posts different class
- Two loops on archive page
- Loop Split two Columns
- How to order posts by title after they have already been sorted by category
- How to make a second query offset -2 from current post
- Running main loop 2 times with conditional statement
- WordPress | Date not always appear [duplicate]
- Array as ‘key’ in WP_Query
- Is_single() conditional tag returns null in query
- Best choice for multiple loop in page?
- WP Query – order posts by meta field first and then order the rest
- Wp_query with 2 meta keys and array of meta values
- Adding a html class based on post count
- Posts in loop all show the same author when there are many authors
- Multiple Rows in a using wp_query
- How to create custom query by keyword in post title?
- If have posts a week old, display, else display a different loop
- Create a loop on my pages with new “WP_Query”
- Create a page template for “top rated posts” but show full content and not just a list
- WP ForLoop to compare meta information of posts to determine what post to display
- How to filter query loop block with a search string from the query parameters
- inserting content of 1 Post to in another with a template hierarchy
- Different Loop for tag pages?
- How to access $wp_query object from array of posts given by get_posts?
- Display all attached image of every post of custom post type and link to original post
- 2 queries with counters
- Search.php – return number of results but cannot loop through
- Creating ‘posts page’ loop based on the page itself
- Links in the_content not linked
- Filter subpages in while loop from WP Query object
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- Custom query does not find pages
- How to sort by most watched in X days/months
- Problem in replacing the_content with the_excerpt()
- How to use custom page for all posts with custom url, call another directory?
- Custom wp_query inside a conditional stament inside a template part doesn’t work: why?
- Duplice post with standard WP loop – fixed by using query_posts() instead
- WP_Query breaking the loop in a nested loop
- Check the stored / cached WP_Query with transients on post change
- New template file does not load category-specific post
- Related posts queries
- Get categories within specific term
- Custom query for custom post type not getting correct post ID
- Query post with content only
- custom excerpt is not being shown
- update_post_meta() not updating
- Insert wp_query after the_content with plugin (filter the_content won’t work)
- Why is my query not giving results?
- Continue loop after $queryObject
- active link for most recent post on vertical tabs
- Can’t get the_content to show
- WP_Query for attachments without duplicating post_parent and displaying tagged image
- List ALL posts within last week from current category on category page
- loop through custom post types with meta data
- Using Query In Post Type Archives
- How ‘secure’ are loops?
- Multiple loops on index page with sticky post and pagination
- How to do a loop inside a loop?
- Main loop querying current template’s info only in custom category archive pages, not my posts
- tax_query not working properly with get_posts
- How can I display sticky posts at first in wp_query?
- Show number of posts AND number on current page (cannot make it work)