Viewing 1 replies (of 1 total)
  • Thread Starter a1.paul

    (@a1paul)

    Found my own solution after bit of a trial and error. Had to add this ‘post_status’ => ‘publish’,

    //user post count
    	public function get_user_posts_count($user_ID){
    		$args = array('author' => $user_ID, <strong>'post_status' => 'publish', </strong>'posts_per_page' => -1);
    		$the_query = new WP_Query( $args );
    		if ($the_query->post_count > 0){
    			return $the_query->post_count;
    		}
    		else{
    			return 0;
    		}
    	}
Viewing 1 replies (of 1 total)
  • The topic ‘Private public posts’ is closed to new replies.