Online Forum To Support Coders With Technical Assistance - Read Write Execute

Limit word count in word press content

Ankit Agrawal
Ankit Agrawal
Published on December 7, 2015 · 1 min read

there is a predefined function to set word limit in wordpress

<?php
$wordCount = 50;
echo wp_trim_words(get_the_content(),$wordCount,'....');
?>
Was this article helpful?
Ankit Agrawal

Ankit Agrawal

Author & Senior Engineer at CodeExecute

Writing practical engineering guides, debugging real-world bottlenecks, and creating free tools for developer productivity.

← Previous Article submit a html form using iframe Next Article → How to get months name and month days between two differente dates?