Performance: Post scheduling and status
MEDIUM IMPACT
This affects the timing of content visibility and server load during page rendering and publishing.
<?php // Use WP_Query with post_status to get only scheduled posts $scheduled_posts = new WP_Query(array( 'post_status' => 'future', 'posts_per_page' => 10 )); ?>
<?php // Query all posts and filter by date manually $all_posts = get_posts(array('numberposts' => -1)); foreach ($all_posts as $post) { if (strtotime($post->post_date) > time()) { // Show as scheduled } } ?>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Manual filtering of all posts for scheduling | High (loads all posts) | Multiple (due to slow server response) | High (delayed content) | [X] Bad |
| WP_Query with post_status = 'future' | Low (only scheduled posts) | Single reflow | Low (fast content load) | [OK] Good |