Title: Creating tags from custom fields?
Last modified: August 19, 2016

---

# Creating tags from custom fields?

 *  [duplosion](https://wordpress.org/support/users/duplosion/)
 * (@duplosion)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/creating-tags-from-custom-fields/)
 * I am trying to create post tags using a combination of pre-existing custom field
   values. For example, let’s say I have two custom fields I want to use:
 * Custom Field 1: City Name
    Custom Field 2: State
 * And what I’d like to do is use SQL to add a [city][state] post tag to all posts
   where those fields have been defined.
 * I’m entirely unsure of how to do this:)
 * Any help you could provide would be very much appreciated.

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/creating-tags-from-custom-fields/#post-1815568)
 * I think this would be very difficult, if not impossible, to do with SQL due to
   the need to generate proper slugs for the terms.
 * Even if that can be done, the need to add rows to 3 tables where the id from 
   the terms table is used in the term_taxonomy table and the taxonomy id from the
   term_taxonomy table is used in the term_relationships table along with the post
   ID from the postmeta table, makes this a very tricky SQL problem.
 * It can probably be accomplished with PHP, but would be a fair sized programming
   problem.

Viewing 1 replies (of 1 total)

The topic ‘Creating tags from custom fields?’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)
 * [tags](https://wordpress.org/support/topic-tag/tags/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/creating-tags-from-custom-fields/#post-1815568)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
