• 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 6 years, 2 months ago by Vlad Kobrenko.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Vlad Kobrenko

    (@kobrenko)

    found a solution to this problem: function ‘pll_count_posts’ ??

    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 5 years, 8 months ago by peperene5150.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Polylang and function wp_count_posts’ is closed to new replies.