Title: Polylang and function wp_count_posts
Last modified: January 23, 2019

---

# Polylang and function wp_count_posts

 *  [Vlad Kobrenko](https://wordpress.org/support/users/kobrenko/)
 * (@kobrenko)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/polylang-and-function-wp_count_posts/)
 * Hi! Thank you for the wonderful plugin 😉 I apologize in advance if this issue
   was raised earlier….
 * Saw the following issue: at the moment when I have selected a specific language
   when calling the standard WP function `wp_count_posts`, the values ​​with the
   total number of posts (including other languages) are returned. How can I fix
   this? Perhaps there are some special functions (or hooks) in polylang?
    -  This topic was modified 7 years, 4 months ago by [Vlad Kobrenko](https://wordpress.org/support/users/kobrenko/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Vlad Kobrenko](https://wordpress.org/support/users/kobrenko/)
 * (@kobrenko)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/polylang-and-function-wp_count_posts/#post-11123059)
 * found a solution to this problem: function ‘pll_count_posts’ 🙂
 *  [peperene5150](https://wordpress.org/support/users/peperene5150/)
 * (@peperene5150)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/polylang-and-function-wp_count_posts/#post-11725169)
 * Hi everyone,
 * here’s the trick:
 * `$published_posts = pll_count_posts( pll_current_language() );`
 * instead of
    `$published_posts = wp_count_posts()->publish;`
    -  This reply was modified 6 years, 10 months ago by [peperene5150](https://wordpress.org/support/users/peperene5150/).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Polylang and function wp_count_posts’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

## Tags

 * [count](https://wordpress.org/support/topic-tag/count/)

 * 2 replies
 * 2 participants
 * Last reply from: [peperene5150](https://wordpress.org/support/users/peperene5150/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/polylang-and-function-wp_count_posts/#post-11725169)
 * Status: not resolved