where('status', 'completed') ->count(); return ++$sent_newsletters; default: return false; } } private static function getLatestWPPost($post_ids) { $posts = new \WP_Query( array( 'post__in' => $post_ids, 'posts_per_page' => 1, 'ignore_sticky_posts' => true, 'orderby' => 'post_date', 'order' => 'DESC' ) ); return (count($posts)) ? $posts->posts[0]->to_array() : false; } }