How to get the number of Pages in a single Post Pagination

Is there a way to query the number of pages/the last page of a single post which is paginated by on wordpress?
function count_post_pages($post_id) {
$the_post = get_post($post_id);
return count(explode(”, $the_post->post_content));
}
I am not sure whether this is the right of way of doing it, but can someone help…

Read more here:: How to get the number of Pages in a single Post Pagination

Leave a Reply

Your email address will not be published. Required fields are marked *