Skip to content

Instantly share code, notes, and snippets.

View crstauf's full-sized avatar
🤔
const THINKING = true;

Caleb Stauffer crstauf

🤔
const THINKING = true;
View GitHub Profile
function trash_past_events() {
$args = array(
'post_type' => 'event',
'posts_per_page' => -1,
'meta_key' => '_date',
'meta_value' => time(),
'meta_compare' => '<'
);
$events = new WP_Query($args);
if ($events->have_posts()) {
@crstauf
crstauf / gist:5750836
Last active December 18, 2015 08:00 — forked from anonymous/gist:5750810
<?php
/**
* I want to get this query to also desplay events that are on the current day.
* Any Ideas on how I can do that?
* I added '>=' instead of '>' but it did not do anything.
* I assume time() does not work when comparing to date becuase the date starts at 0:00, so anytime on the current day will be past 0:00
*/
$args = array(
'post_type' => 'event',