Title: Excluding by Tag String, Register by Function?
Last modified: August 21, 2016

---

# Excluding by Tag String, Register by Function?

 *  [Kry8ter](https://wordpress.org/support/users/kry8ter/)
 * (@kry8ter)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/excluding-by-tag-string-register-by-function/)
 * I have 3 loops running on the front page.
 * One for the slider, and it wants posts that have the tag “slider”.
 * One for featured articles, and it wants posts that have the tag “featured”.
 * And a third I am calling in loop_latest.php, it wants the 6 latest posts; the
   trick here is those need to be the 6 latests that do NOT have the tags “slider”
   or “featured”.
 * So I have this query.
 *     ```
       $query = new WP_Query(
            array(
                     'showposts' => '6',
                     'tag_not_in' => array('featured, slider'),
            ) );
       ```
   
 * I’m pretty sure the problem here is that “tag_not_in” doesn’t like strings, it
   wants IDs.
 * SO! Is there a way to pass it the strings?
 * If not, how do I divine what the IDs of tags are?
 * Can I run some code in “functions.php” to set and reserve the ids? featured =
   = 777, slider == 888
    Something like that?
 * I’d like to be able to SET them so that gets packaged with this theme. Rather
   than have to hope that when the client registers the tags “slider” and “featured”
   they match up with what I have chosen in the loops/query.
 * Thanks for your help, my google-fu isn’t working out on this one.

Viewing 1 replies (of 1 total)

 *  Thread Starter [Kry8ter](https://wordpress.org/support/users/kry8ter/)
 * (@kry8ter)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/excluding-by-tag-string-register-by-function/#post-3998695)
 * ANSWERED OVER HERE FOR REFERENCE
 * [http://stackoverflow.com/questions/18068115/wordpress-loops-excluding-by-tag-string-register-by-function](http://stackoverflow.com/questions/18068115/wordpress-loops-excluding-by-tag-string-register-by-function)

Viewing 1 replies (of 1 total)

The topic ‘Excluding by Tag String, Register by Function?’ is closed to new replies.

## Tags

 * [exclude](https://wordpress.org/support/topic-tag/exclude/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [register](https://wordpress.org/support/topic-tag/register/)
 * [set](https://wordpress.org/support/topic-tag/set/)
 * [string](https://wordpress.org/support/topic-tag/string/)
 * [tag](https://wordpress.org/support/topic-tag/tag/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 1 participant
 * Last reply from: [Kry8ter](https://wordpress.org/support/users/kry8ter/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/excluding-by-tag-string-register-by-function/#post-3998695)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
