Use both meta query and tax query

Would you believe it, as soon as I posted this I remembered I asked a question about a query last year. I had a look over it and I’ve adapted my new query like so: $category_slug = filter_input( INPUT_GET, ‘eventtype’, FILTER_SANITIZE_STRING ); $cat_query = []; if( $event_type ){ $cat_query = [ [ ‘taxonomy’ => ‘eventtype’, … Read more

How to filter posts by specific date and its tag

Ashur Please try following code with date_query. this is working fine at my end. Let me know if you want any additional detail. <?php $postdate = get_the_date(‘Y-m-d’); $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘post’, ‘date_query’ => array( ‘after’ => $postdate, ) ); $update = new WP_Query($args); while ($update->have_posts()) { $update->the_post(); $post_id = get_the_ID(); … Read more

meta_query for a string inside a meta field containing a comma-separated list

Is there a smart way to meta_query so it matches just “IS, but not “TS-IS”? The WordPress meta query class (WP_Meta_Query), which among others, is used with the posts (WP_Query) and users (WP_User_Query) query classes, supports REGEXP (since WordPress 3.7) as the compare value, so you could use that with a RegEx (regular expresion) pattern … Read more

Display no post when metavalue is 0

Here’s an updated example that appears to do what you want. See the docs for meta queries for details. $query_args = [ ‘post_type’ => ‘list’, ‘posts_per_page’ => 3, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DESC’, ‘meta_query’ => [ [ ‘key’ => ‘post_views_count’, ‘value’ => 50, ‘compare’ => ‘>’, ‘type’ => ‘NUMERIC’, ], ], ]; $post_views_query = … Read more

How do I find if a page has a template?

This should do the trick for you. This shows what template file is stored in post_meta, if one has been selected in the admin panel: $template_name = get_post_meta( $the_query->post->ID, ‘_wp_page_template’, true ); If you want to see if the page is the homepage, use is_home() or is_front_page(). If you want to see what files are … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)