Display posts between two particular dates

I think its because the SQL statement needs the dates inside the quotation marks. Try $where .= ” AND post_date >= ‘$s’ AND post_date <= ‘$e'”; That should work, otherwise, try $where .= ” AND post_date >= ‘”.$s.”‘ AND post_date <= ‘”.$e.”‘”;

paginate_links on custom query in admin – ‘sufficient permissions’ error

The last part of the URL is being treated as part of the page value.. /wp-admin/admin.php?page=user-feedback/user-feedback.php/page/2/ The bold part is your plugin page, so when you go adding parts onto that URL it’s considered to be part of that URL. If you use this instead it should work no problem. /wp-admin/admin.php?page=user-feedback/user-feedback.php&paged=2 Note: You can actually … Read more

Query posts and filter at query time by value of custom meta

This is super easy to do with meta_querys: $args = array( //basics ‘post_type’ => ‘prizes’, // from question ‘post_status’ => ‘publish’, // you didn’t have this, but it’s good practice ‘posts_per_page’ => 3, // I don’t know where you got ‘showposts’, but that’s WAY old //order ‘orderby’ => ‘rand’, //meta query ‘meta_query’ => array( array( … Read more

Custom SELECT Query With Multiple Meta Values (Ordering Problem)

I believe you can achieve this with WP_Query and avoid the custom SQL: $today = date( ‘Y-m-d’ ); $args = array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘ID’, ‘terms’ => 15 ) ), ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘event_enddate’, ‘value’ => $today, ‘compare’ => ‘>=’ ) ), ‘meta_key’ … Read more