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
- How to get posts published between a date and today?
- How to Display Network Post Count?
- How to cache a shortcode functions output?
- 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
- Set font size automatically according to number of words in post
- Can’t show comments count per post outside loop
- Only display posts with comments
- Redirect based on user post count
- Alternate custom content in the loop
- Order post by year DESC and month ASC
- Show the author’s count of total amount of posts assign to a custom taxonomy term
- Filter Posts By Tag
- Can I set and show “important” post in my blog?
- Count total number across post types
- Improving WP_Query for performance when random posts are ordered
- 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
- How To Get Posts With A Specific Word
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Display posts with tag that matches current post title
- Why is querying posts messing up my pages?
- Category Foreach keeps looping?
- How can I get global $post to work for CPT and update user?
- Multi row post list
- posts_per_page option limits the number of Gallery items
- wp_posts table: safely remove unused columns to save database storage
- Display Posts on Custom Page
- How to add category post count in main navigation menu [closed]
- Nested WP_Query breaking loop
- Query for first 3 posts to change the look and feel
- Archive template combined with post slider and regular posts
- How to only publish posts with image in it
- Get post number both in the loop and in the post
- wp_query with ajax
- How to give classname to post if post has no content?
- Custom posts listing widget always returns 1 extra result
- Count the number of a post types associated with another post type
- WordPress post filter menu
- Bootsrap carousel for post
- Get postlist for each category using query_posts?
- How to save posts position on homepage after random function?
- WordPress query portfolio posts
- WordPress displays post on subcategory only
- How to get posts ordered by using their categories?
- Trying to query all posts in category 4
- Display 3 posts with different HTML markup using a loop
- How to assign a post to a post parrent?
- query for filtering published posts?
- get parent fields title, content excerpt etc
- AWS usage queries
- Pull in posts using post meta for REST API
- get posts, run a custom query, and join the results
- Author post count in category
- Set post title font size automatically according to number of words in post title
- Displaying all posts from other sites on the network on one site
- How to fetch courses in all languages in WordPress?
- Multisite how to display merged posts from two sites and sort by latest date?
- How to show post views shortcode data for each post on Posts List Page?
- Show post count in custom taxonomy page
- Count singular post views automatically
- How to count posts in tags within time limit
- How can I use query_posts to loop through posts and construct my own content?
- Display Custom Post Category Count & WordPress Category Count Using Shortcode
- Assign a day of the week to post, e.g: Assign Monday to post and have it only appear when the day is Monday
- Show 5 posts and than 3 posts offset with pagination
- Display number of post published every day
- WP_Query to get posts in a specific tag or has post_format
- Retrieve posts inside foundation tabs and tab-content split by 3 per row
- Make recent post display recent updated, instead of recent published
- Alternative content between posts no repetition
- Manipulate query to show specific post
- Blog posts not displaying on blog posts page
- How to control Post view count incresing in sidebar widget posts too?
- Sort / Filter Queries
- get_page_by_title() not working if special characters are present
- Modify WordPress loop after it has been run
- get “read more” with custom DB query like you would with WP Query
- Ordering posts alphabetically by meta keys and title
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How do I control the fallback query after the original query returned cero posts?
- Remove duplicated posts in the loop if post has more than one category
- Adding a category at even positions on main loop with modified pagination
- How to mark every 3rd post
- Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)
- How to get alphabetic listing x other posts, based on first letter post?
- ho can I get the number of the current post instead of the post id?
- wp trim function not working
- Adding Count Post in Page
- Change from all posts to specific categories post on main page?
- Sort Posts Alphabetically Based on Specific Category (Divi)
- How to change url of posts?