You will need a function to get all the published posts and count the words.
function wpse410818_count_published_words() {
$posts = new WP_Query(array(
'post_type' => array( 'post' ),
'post_status' => 'publish',
));
$count = 0; //Starting words count
if ( $posts->have_posts() ) {
while ( $posts->have_posts() ) {
$posts->the_post();
//Add to the word count
$count += str_word_count(trim(strip_tags(strip_shortcodes(get_the_content()))));
}
}
echo $count;
}
This will query the database everytime it runs, therefor, you might want to cache the result and update it when a new post is published or an existing post is modified.
Related Posts:
- Counter is skipping post when I still want it visible [closed]
- Echo the number of posts being displayed
- Word count for all posts of all authors
- How to mark every 3rd post
- Keep featured content post in homepage with original order
- How to get posts published between a date and today?
- How to show related posts by category
- Count posts within a custom post type and specific taxonomy and terms?
- How to Display a List of Users Who Have Made at Least 1 Post?
- the_author() returns empty string
- How to Display Network Post Count?
- Display all posts from specific categories on a page
- How to cache a shortcode functions output?
- How to exclude latest x posts from a paginated query?
- Display content from a specific category
- How to display posts by current user/author in a custom page template?
- Count posts in category including child categories
- post_name empty after wp_insert_post
- Query posts distinct authors
- How to get previous 10 days post from a specific date – WP Query
- Number of posts per page setting is not working?
- Count singular post views automatically
- WordPress Posts Out Of Order after 3.1 Update
- Query only Posts from Both of Two Category?
- Set font size automatically according to number of words in post
- Insert custom div between posts
- Can’t show comments count per post outside loop
- Only display posts with comments
- Network wide post count (WP Multisite)
- Redirect based on user post count
- Alternate custom content in the loop
- Order post by year DESC and month ASC
- WordPress get posts by date without query_posts
- How to Display Post View Count
- Different amount of posts on homepage than paged pages
- Show that current post is number X out of X
- Featured Posts for Category Pages
- Cannot Update A Post, 404 Error
- Show the author’s count of total amount of posts assign to a custom taxonomy term
- Function to show random posts from a category
- Hiding posts in a list from specified categories
- Double count view in archive.php
- How would I get 1 latest post from a query for 5 posts?
- Filter Posts By Tag
- Can I set and show “important” post in my blog?
- Count to how many categories a post belongs to
- Exclude posts with empty post_content in wp_query
- Count total number across post types
- Improving WP_Query for performance when random posts are ordered
- Count search results in heading
- How to hide first gallery for every post?
- Create dropdown list post
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- previewing my posts on static page?
- Exclude newest post from category X but show rest
- Reset Popular post query?
- Counter of posts ever posted – even deleted ones
- Display Published Posts Count for Certain Time Period
- Inserting custom data to the_post() during loop
- How To Get Posts With A Specific Word
- Why WP_Query(‘showposts=5’) shows only 1 post?
- is there a way to show the the post title after the image?
- Display posts with tag that matches current post title
- Why is querying posts messing up my pages?
- Display all posts that were published before full post on single.php
- Category Foreach keeps looping?
- Blog post per page setting conflicting with custom WP_Query?
- How to exclude latest x posts from a paginated query?
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- How can I get global $post to work for CPT and update user?
- Random ajax load only works with posts_per_page set to -1
- Display an author’s posts on his own author page
- Multi row post list
- posts_per_page option limits the number of Gallery items
- How to make multiple sections in home pulling posts category wise?
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- Order posts alphabetically: how to set order=asc in mysql query?
- How to order posts in an arbitrary order?
- Display Notification Bar on Header on Certain Post Count
- Display Posts on Custom Page
- How to get posts from a current post’s month?
- Show posts count for Categories and Tags in wp_nav_menu
- Wrong post title displayed from loop
- How to add category post count in main navigation menu [closed]
- Nested WP_Query breaking loop
- WordPress query_posts by tag doesn’t work anymore(?)
- While loop articles – if statement order
- do more action after I publish a post
- Retrieve only posts from a specific user in wp-admin/edit.php
- Count number of posts of current month
- Conditionals if tags exist?
- WordPress website loads more posts than expected
- Get the amount of posts on a current page
- Howto show comment count by post in post?
- Posts – display all posts except a post by an ID
- query post limits
- why the same code got different results when using query_posts in functions.php and index.php
- Display Posts with template on a Page
- Query for first 3 posts to change the look and feel