Coding the Plugin Logic
Learn how to calculate the post metrics.
We'll cover the following
Filter content to calculate post metrics
Now we will add the logic to calculate the read time and word statistics for the post metrics plugin. We need to filter the content of a post to be able to make these calculations.
We saw an example of filtering the post content in the Introduction to Plugin Development lesson. Using the add_filter
function in the constructor, we will hook on to the the_content
filter and call a method calculate_post_metrics
at that filter.
Get hands-on with 1400+ tech skills courses.