[wp-hackers] Messin with queries...

Austin Matzko if.website at gmail.com
Sat Feb 28 19:16:08 GMT 2009


On Sat, Feb 28, 2009 at 11:29 AM, Stefano Aglietti <steagl4ml at gmail.com> wrote:
> I can't get a query to get the tags used in last XX days except some i
> will pass to the query to exclude, I have to do this on WP 2.3 but i
> can't sort out a uniqe query to get the tags.

If you want to query for a tag with ID of 3 in the last 5 days, do the
following (this does work in WordPress 2.3):

function filter_where($w = '') {
        $w .= " AND post_date > '" . date('Y-m-d', strtotime('-5 days')) . "'";
        return $w;
}
add_filter('posts_where', 'filter_where');

query_posts(array(
        'tag__in' => array(3),
));


For future reference, the WordPress support forum is a better place
for support questions: http://wordpress.org/support/

WP-Hackers is meant for development discussions.  Thanks!


More information about the wp-hackers mailing list