Exclude category from Tag Template

Have you tried using a normal loop in your tag template like this <?php while ( have_posts() ) : the_post() ?> //add content code or template <?php endwhile; ?> And then using the pre_get_posts filter like this function exclude_category( $query ) { if ( $query->is_tag() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-433’ ); } } … Read more

WP_Query Excluding pages with Order is 0

You can define custom where like this if your table is wp_posts function _20170112( $where ){ $where = $where . ‘ AND wp_posts.menu_order > 0 ‘; return $where; } And sandwich your query with this: $args = array( ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ‘meta_key’ => ’tile-home’, ‘meta_value’ => 1, ‘orderby’ => ‘menu_order’, ‘order’ => … Read more

Exclude custom taxonomy tag from loop

I have rewritten the query_posts. As for get_posts you are better off using the WP_Query due to more control over the tax_query. Explained here. <?php $args = array( ‘cat’ => 84, ‘posts_per_page’ => 3, ‘offset’ => 0, ‘tax_query’ => array( ‘relation’ => ‘NOT IN’, array( ‘taxonomy’ => ‘display’, ‘field’ => ‘slug’, ‘terms’ => ‘featured-slider’ ) … Read more

Exclude specific taxonomy term when using wp_get_post_terms

I’d use wp_list_filter() with the operator ‘NOT’ to compare either the term’s name, slug or ID (depending how you want to test for term to be exluded). Untested but something like this should work (assuming that you want to exclude the term with slug ‘myslug’): $terms = wp_get_post_terms( $post->ID, ‘wedding_cat’); $terms = wp_list_filter($terms, array(‘slug’=>’myslug’),’NOT’); (Of … Read more

How do I exclude posts by custom field value?

You can use meta query in wp query to get required posts $args = array( ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘city’, ‘value’ => ‘Melbourne’, ‘compare’ => ‘NOT LIKE’ ), array( ‘key’ => ‘city’, ‘value’ => ‘Melbourne’, ‘compare’ => ‘NOT EXISTS’ ) ) ); $query = new WP_Query( $args );

Exclude category from category archive

If everything else is doing what you want, change this line: $categories = get_categories(‘hide_empty=0’); To this: $categories = get_categories(‘hide_empty=0&exclude=10′); Swap ’10’ with the category number you want to exclude.

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