Skip to main content
added 585 characters in body
Source Link
Brad Dalton
  • 7k
  • 2
  • 36
  • 47

Paste this code at the end of your child themes functions.php file.

It will exclude all posts with the comma separated list of tag i.d's from displaying on the home page loop.

add_filter('request', 'filter_tag_loop');
function filter_tag_loop($params) {
$params['tag__not_in'] = array(49);
return $params;
}

Or you could use WP_Query

$query = new WP_Query( array( 'tag__not_in' => array( 46,5,101,22,122,7,102,15,104,47,105,66,43,123 ) ) );

http://codex.wordpress.org/Class_Reference/WP_Query

Or use pre_get_posts (untested)

add_action( 'pre_get_posts', 'wpsites_include_exclude_tagged_posts' );

function wpsites_include_exclude_tagged_posts( $query ) {

if ( $query->is_main_query()  && $query->is_home() ) {

    $query->set( 'tag__in' => array (46, 5, 101, 22, 122, 7, 102, 15, 104, 47, 105, 66, 43, 123)),
    $query->set( 'tag__not_in' => array (10,121,20,36,23,24,21,76,82,17,6,106,8,75,54,38,57,86,56,95,25,62,16,39,40,69,37,9,42,41,87,73,85));
    }
}

http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts

Paste this code at the end of your child themes functions.php file.

It will exclude all posts with the comma separated list of tag i.d's from displaying on the home page loop.

add_filter('request', 'filter_tag_loop');
function filter_tag_loop($params) {
$params['tag__not_in'] = array(49);
return $params;
}

Or you could use WP_Query

$query = new WP_Query( array( 'tag__not_in' => array( 46,5,101,22,122,7,102,15,104,47,105,66,43,123 ) ) );

http://codex.wordpress.org/Class_Reference/WP_Query

Paste this code at the end of your child themes functions.php file.

It will exclude all posts with the comma separated list of tag i.d's from displaying on the home page loop.

add_filter('request', 'filter_tag_loop');
function filter_tag_loop($params) {
$params['tag__not_in'] = array(49);
return $params;
}

Or you could use WP_Query

$query = new WP_Query( array( 'tag__not_in' => array( 46,5,101,22,122,7,102,15,104,47,105,66,43,123 ) ) );

http://codex.wordpress.org/Class_Reference/WP_Query

Or use pre_get_posts (untested)

add_action( 'pre_get_posts', 'wpsites_include_exclude_tagged_posts' );

function wpsites_include_exclude_tagged_posts( $query ) {

if ( $query->is_main_query()  && $query->is_home() ) {

    $query->set( 'tag__in' => array (46, 5, 101, 22, 122, 7, 102, 15, 104, 47, 105, 66, 43, 123)),
    $query->set( 'tag__not_in' => array (10,121,20,36,23,24,21,76,82,17,6,106,8,75,54,38,57,86,56,95,25,62,16,39,40,69,37,9,42,41,87,73,85));
    }
}

http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts

added 100 characters in body
Source Link
Brad Dalton
  • 7k
  • 2
  • 36
  • 47

Paste this code at the end of your child themes functions.php file.

It will exclude all posts with the comma separated list of tag i.d's from displaying on the home page loop.

add_filter('request', 'filter_tag_loop');
function filter_tag_loop($params) {
$params['tag__not_in'] = array(49);
return $params;
}

Or you could use WP_Query

$query = new WP_Query( array( 'tag__not_in' => array( 46,5,101,22,122,7,102,15,104,47,105,66,43,123 ) ) );

http://codex.wordpress.org/Class_Reference/WP_Query

Paste this code at the end of your child themes functions.php file.

It will exclude all posts with the comma separated list of tag i.d's from displaying on the home page loop.

add_filter('request', 'filter_tag_loop');
function filter_tag_loop($params) {
$params['tag__not_in'] = array(49);
return $params;
}

Paste this code at the end of your child themes functions.php file.

It will exclude all posts with the comma separated list of tag i.d's from displaying on the home page loop.

add_filter('request', 'filter_tag_loop');
function filter_tag_loop($params) {
$params['tag__not_in'] = array(49);
return $params;
}

Or you could use WP_Query

$query = new WP_Query( array( 'tag__not_in' => array( 46,5,101,22,122,7,102,15,104,47,105,66,43,123 ) ) );

http://codex.wordpress.org/Class_Reference/WP_Query

deleted 56 characters in body
Source Link
Brad Dalton
  • 7k
  • 2
  • 36
  • 47

Paste this code at the end of your child themes functions.php file.

It will exclude all posts with the comma separated list of tag i.d's from displaying on the home page loop.

add_action( 'pre_get_posts', 'wpsites_exclude_tag' );

function wpsites_exclude_tag( $query ) {

if( $query->is_main_query() && $query->is_home() ) {

$query->set( 'tag', '-46,-5,-101,-22,-122,-7,-102,-15,-104,-47,-105,-66,-43,-123');
    }
}

Or you could use something like this:

add_filter('request', 'filter_tag_loop');
function filter_tag_loop($params) {
$params['tag__not_in'] = array(49);
return $params;
}

Paste this code at the end of your child themes functions.php file.

It will exclude all posts with the comma separated list of tag i.d's from displaying on the home page loop.

add_action( 'pre_get_posts', 'wpsites_exclude_tag' );

function wpsites_exclude_tag( $query ) {

if( $query->is_main_query() && $query->is_home() ) {

$query->set( 'tag', '-46,-5,-101,-22,-122,-7,-102,-15,-104,-47,-105,-66,-43,-123');
    }
}

Or you could use something like this:

add_filter('request', 'filter_tag_loop');
function filter_tag_loop($params) {
$params['tag__not_in'] = array(49);
return $params;
}

Paste this code at the end of your child themes functions.php file.

It will exclude all posts with the comma separated list of tag i.d's from displaying on the home page loop.

add_filter('request', 'filter_tag_loop');
function filter_tag_loop($params) {
$params['tag__not_in'] = array(49);
return $params;
}
added 204 characters in body
Source Link
Brad Dalton
  • 7k
  • 2
  • 36
  • 47
Loading
Source Link
Brad Dalton
  • 7k
  • 2
  • 36
  • 47
Loading