This filter doesn't work
-
I’m trying to use this code that I take from wordpress codex, but the filter is not taking effect.
` <?php
function filter_where($where = ”) {
//posts in the last 24 Hours
$where .= ” AND post_date > ‘” . date(‘Y-m-d H:i:s’, strtotime(‘-36 hours’)) . “‘”;
return $where;
}
add_filter(‘posts_where’, ‘filter_where’);
$query = new WP_Query(“cat=”.$categoria.””);
?>
<?php if(have_posts()) : ?><?php while($events_query->have_posts()) : $postnum = $postnum + 1; $events_query->the_post(); ?>
<h1 class=”negrocentro”>“><?php the_title(); ?></h1>
<?php endwhile; ?>
<?php endif; ?>
<?php
remove_filter( ‘posts_where’, ‘filter_where’ );
?>
- The topic ‘This filter doesn't work’ is closed to new replies.