Thread Starter
Gustav
(@4ever16)
But what the correct code? I cant figure it out.
Tested with doesnt work.
<?php
$current_user = wp_get_current_user();
if ( 0 == $current_user->ID ) {
// Not logged in.
} else {
echo $user_post_count = count_user_posts( $current_user );
}
?>
<?php
$current_user = wp_get_current_user();
if ( 0 == $current_user->ID ) {
// Not logged in.
} else {
$userid = wp_get_current_user();
echo $user_post_count = count_user_posts( $userid );
}
?>
-
This reply was modified 7 years, 10 months ago by
Gustav.
<?php
$current_user = wp_get_current_user();
if ( 0 == $current_user->ID ) {
// Not logged in.
} else {
$user_post_count = count_user_posts( $current_user->ID );
echo $user_post_count;
}
?>
should work
Thread Starter
Gustav
(@4ever16)
Solved it.
<?php
$current_user = wp_get_current_user();
if ( 0 == $current_user->ID ) {
// Not logged in.
} else {
echo count_user_posts( $current_user->ID );
}
?>