This is more PHP as you need to use str_word_count()
to count the amount of words in the excerpt. Just note, to be safe, if you allow any tags in the excerpt, you would want to use strip_tags()
to remove html tags to avoid incorrect word counts.
EXAMPLE:
echo str_word_count( strip_tags( get_the_excerpt() ) );
If you need to display wordcount on the front end, you can also wrap the above in number_format_i18n()
to return the integer value according to locale set
echo number_format_i18n( str_word_count( strip_tags( get_the_excerpt() ) ) );
Related Posts:
- C++ – how to find the length of an integer
- How can I make a PHP counter?
- Counting the posts of a loop (WP_Query)?
- Category and children post count
- Hide the post count behind Post Views (Remove All, Published and Trashed) in Custom Post Type
- How to display 2 equal columns of li based on the count of items in wp_nav_menu divided by 2?
- Show weekly posts statistic in WordPress
- Increasing post view count automatically [duplicate]
- Count number of posts by author in a category
- How we count the user draft posts
- What is the best way to count and display the number of posts?
- Get count of terms with a post and another taxonomy term?
- Get Gravity Forms field values and count how many? [closed]
- Counting posts in custom post type by author
- Show ellipsis (…) only if the number of characters exceeds limit defined in substr
- Get total views of all posts by author
- Count post + add number =
- How to do simple addition to increase favorites count of my wordpress posts
- Count posts published in one particular day: the lighter way
- What is the best way to do this? [closed]
- Search Count WordPress Theme
- $count_posts->draft & published
- CountPost WordPress Custom Taxonomy
- Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)
- get the count of table rows
- Issues with the excerpt (wordcount/HTML/images)
- How to calculate posts number? [closed]
- How make animation increase of number
- Having problems getting the number of plays in a WordPress Playlist from an audio file
- How to show the amount of post that have on the site?
- Adding a posts count in archive pages
- Adding count also to parent categories
- Counting the number of elements with the values of x in a vector
- PHP 7.2 – Warning: count(): Parameter must be an array or an object that implements Countable
- How can I count the occurrences of a list item?
- How to count the occurrence of certain item in an ndarray?
- Pandas ‘count(distinct)’ equivalent
- How to sort a list of objects based on an attribute of the objects?
- Count the number of occurrences of a character in a string
- Calculate average in java
- Counting the occurrences / frequency of array elements
- Count how many files in directory PHP
- How to count the number of files in a directory using Python
- How to find length of digits in an integer?
- select count(*) from table of mysql in php
- How to get the count of each distinct value in a column?
- How to count instances of character in SQL Column
- Allow HTML in excerpt
- Get excerpt using get_the_excerpt outside a loop
- GET the excerpt by ID
- Using wp_trim_excerpt to get the_excerpt() outside the loop
- How to mark every 3rd post
- How to end the excerpt with a sentence rather than a word?
- Remove more or […] text from short post
- How can i display the content in plaintext
- How can i limit the character length in excerpt? [duplicate]
- Move excerpt meta box to above content editor
- Return only Count from a wp_query request?
- apply_filters() and the_excerpt are giving unexpected results
- Count & Display Database Queries
- How can I create a “Read More” link using the_excerpt() on a static front page?
- Count posts within a custom post type and specific taxonomy and terms?
- Compare the_excerpt() to the_content()
- How to remove “read more” link from custom post type excerpt
- How to Display a List of Users Who Have Made at Least 1 Post?
- Adding a rich text editor to Excerpt
- the_excerpt and shortcodes
- How to force excerpts / teasers in the loop
- How to include line-breaks in the_excerpt?
- How to control manual excerpt length?
- How to get the unfiltered excerpt, without […] or auto-excerpting
- How to Display Network Post Count?
- Remove “Continue Reading” Link From the Teaser Excerpt Only
- Customizing get_the_excerpt() to specific length and “Read More” output.
- Display Links in Excerpts?
- excerpt in characters
- Taxonomy count per Post type
- Mandatory excerpt for custom post type
- How do I filter the excerpt metabox description in admin?
- WP 3.5 and Galleries – how to count images?
- Modify youtube video size on one page and show another size on different page
- Modify ‘Read more’ link adding a new class
- Remove Ellipses from Excerpt
- Get excerpt from $post->post_content
- Count the number of images uploded on the website
- How to get attachment caption (get_the_excerpt gives parent post excerpt) ?
- Generate a excerpt from an ACF-wysiwyg-field
- Read more tag shows up on EVERY post
- Check if the user has explicitly set an excerpt
- Multiple versions of RSS feed? One with full content, one with the excerpt
- Total word count for posts by one author
- How to cache a shortcode functions output?
- show number of open comments on custom dashboard
- count posts from custom taxonomy terms by year
- Count posts or custom post types from last 24 hours (or from today)
- First three images in post excerpt
- Comment Count for each Comment Author
- Issue with enabling formatting in excerpts in WordPress
- limit the words in the post content and add read more link
- Display user’s total comment count outside The Loop