Disable the MySQL query in the main query

Check if this solution work for your case: add_filter(‘posts_request’, ‘supress_main_query’, 10, 2); function supress_main_query( $request, $query ){ if( $query->is_main_query() && ! $query->is_admin ) return false; else return $request; } posts_request is the last filter called before running the query, and pass to you the $requestvariable with the generated SQL string and $query, with the WP_query … Read more

how to query multiple categories in wordpress?

Use like this query_posts( array( ‘category__in’ => array(5,1), ‘posts_per_page’ => 1, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’ ) ); or $my_query = new WP_query(array(‘category__and’ => array(5,1))); while ($my_query->have_posts()) : $my_query->the_post();

$wpdb doesn’t appear to work on page inside of a plugin

The $wpdb object is part of WordPress, so wouldn’t be loaded into a standalone PHP page as it is into a WordPress template. You might want to look into creating your own page templates, then you could run your database query as part of that page template. As a side note: You are currently trusting … 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)