code: public function get_posts() {
  
  		$total_posts = wp_count_posts();
  		$total_posts = isset( $total_posts->publish ) ? $total_posts->publish : 0;
  
  		return get_posts(
  			[
  				'post_type'   => 'post',
  				'numberposts' => $total_posts,
  				'post_status' => 'publish',
  			]
  		);
  	}
docs: Get publish posts.
  
  @since 1.0.1
  
  @return array → posts