Combine “Exclude” Query in functions.php

Just put both if statements with || (or) in the one callback function: function wpse_283481_exclude_posts( $query ) { if ( ( $query->is_main_query() && $query->is_home() ) || $query->is_feed() ) { $query->set( ‘cat’, ‘-103’ ); } } add_action( ‘pre_get_posts’, ‘wpse_283481_exclude_posts’ );

How to list all tags except the current tag in tag.php

You may try get_tags with exclude parameter. https://codex.wordpress.org/Function_Reference/get_tags get_queried_object_id get the tag ID from tag page. $tags = get_tags(array( ‘exclude’ => get_queried_object_id(), )); $tagList = array(); foreach($tags as $tag) { $tagList[] = ‘<a href=”‘.get_tag_link($tag->term_id).'”>’.$tag->name.'</a>’; } echo implode(‘, ‘, $tagList);

Exclude Specific Tag On Homepage

This should work function exclude_posts( $query ) { if ( $query->is_home() ) { $query->set( ‘tag__not_in’, array( 13 ) ); } } add_action( ‘pre_get_posts’, ‘exclude_posts’ ); tag and tag_id are not set up like cat to accept negative numbers (ID numbers) for exclusion (conclusion based on experiments, not digging into the code (some other time, perhaps!)). … Read more

How to exclude posts that already appear in the main loop, from the category loop

<?php get_header(); ?> <section class=”content latest”> <h2>Latests 20 posts</h2> <ul> <?php $the_query = new WP_Query( ‘posts_per_page=20’ ); ?> <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> <?php $excludeID[] = $post->ID; ?> <li> <!– post thumbnail linking to the single post page –> <?php if ( has_post_thumbnail() ) : ?> <a href=”https://wordpress.stackexchange.com/questions/366403/<?php the_permalink(); ?>” … Read more

Exclude Custom post type from /blog page

you can try this one function exclude_some_post_type($query) { if ( ! is_admin() && $query->is_main_query() ) { if ( $query->is_search || is_home() ) { // in search page $query->set( ‘post_type’, ‘post’ ); } } } add_action( ‘pre_get_posts’, ‘exclude_some_post_type’ ); The function that applied to a pre_get_posts hook will set only default post type (post), and will … Read more

Functions.php: Exclude Category from “Blog”

http://codex.wordpress.org/Function_Reference/is_main_query add_action( ‘pre_get_posts’, ‘foo_modify_query_exclude_category’ ); function foo_modify_query_exclude_category( $query ) { if ( $query->is_main_query() && ! $query->get( ‘cat’ ) ) $query->set( ‘cat’, ‘-5′ ); } So it’s quite obvious to how exclude certain categories from within a template, … Actually it’s not. Are you talking about query_posts() !?

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