Viewing 2 replies - 1 through 2 (of 2 total)
  • Try with this url structure

    https://example.com?exclude=dogs,cat,fish

    this code

    $exclude_tags = explode(",", $_REQUEST['exclude']);;
    $exclude_tags_ids = array();
    
    foreach( $exclude_tags as $i){
           $exclude_tags_ids[] = get_term_by('slug',$i, 'post_tag');
    
    }
    
    $args=array(
      'tag__not_in' => $exclude_tags_ids,
      'post_type' => 'post',
      'post_status' => 'publish',
      'numberposts'=>20,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
     ....
    Thread Starter geekjon

    (@geekjon)

    Thanks. This looks promising, but I haven’t been able to test it yet.
    Do you happen to know how to modify this to be a simple plugin?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to exclude tags via URL parameters?’ is closed to new replies.