WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have a "featured" section on home page. i want to hide this section after 10 minutes of post publish time. here is the code, i am using. problem is that it hide the "featured" section after 12 hours of post publish time

------- index.php -------

<?php $args = array(
    'posts_per_page' => 1, // We are showing only one post
    'category_name' => 'featured_post' // showing form category prime

add_filter( 'posts_where', 'filter_where' );
$the_query = new WP_Query( $args );
remove_filter( 'posts_where', 'filter_where' ); ?>

if ($the_query->have_posts()) :?>
 <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<?php endwhile; ?>
<div class="featured_post">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php endif; ?>

------- Function.php -------

 function filter_where( $where = '' ) {
 // posts published last 30 minutes
 $where .= " AND post_date > '" . date('Y-m-d H:i:s', strtotime('-10 minutes')) . "'";
 return $where;

please guide me.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.