WP_query for posts with same post type AND same post category

You are using default category for custom post type. You can instead use a taxonomy query to get filtered result based upon your custom taxonomy terms. Try this – $cat_ids = array(); $postID = get_the_ID(); $categories = get_the_terms($postID, ‘custom_taxonomy_name’); //this will give all the terms foreach($categories as $cat) { $cat_ids[] = $cat->term_id; //you may put … Read more

WP_Query secondary query failing

Maybe you can try with get_posts() and foreach loop for the second query instead of WP_Query and then you will have something like this: <?php $secondary_query = get_posts(‘category_name=students’); foreach($secondary_query as $secondary_post): echo “<li>” . get_the_title($secondary_post->ID) . “</li>”; endforeach; ?> With above like style you don’t need wp_reset_query() just make sure you pass the post ID … Read more

WP_query issue with no posts

By using those named GET variables such as year or monthnum you effectively short circuit the URL rewrite (if you are using pretty permalinks). This way you end up querying the main WP_Query instance first and effectively making yours completely useless (well, you do alter the posts_per_page attribute so there’s that). Anyway, the point is … Read more

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