This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://gist.github.com/krava/6322195 | |
// Wordpress wp_query date range date_from date_to filter. | |
add_filter('posts_where', 'wapp_filter_posts_where'); | |
function wapp_filter_posts_where($where) { | |
global $wp_query; | |
if (isset($wp_query->query['date_from']) && isset($wp_query->query['date_to'])) { | |
$date_from = $wp_query->query['date_from']; | |
$date_to = $wp_query->query['date_to']; |