i want to show the count of question and ansers

6.45K viewsCore
0

so i use this code

<?php
$count_posts = wp_count_posts(Questions);
echo $count_posts->publish;
?>

it’s not working idont know why
is the custom post have another name ?
if so what is the name of the custom post for questions and answers

0

thanks man
my user name sm_rasmy in wordpress org

0

thanks man but this code gave me this result

object(stdClass)#800 (9) { [“publish”]=> string(1) “5” [“future”]=> int(0) [“draft”]=> string(1) “1” [“pending”]=> int(0) [“private”]=> int(0) [“trash”]=> string(1) “1” [“auto-draft”]=> int(0) [“inherit”]=> int(0) [“moderate”]=> int(0) }

Then just use this: $count->publish.
And let me know your wordpress.org username

1

There is mistake in your code, use this:

<?php
    $count = wp_count_posts('question');
    echo var_dump($count);
?>