Title: Custom fields: Using &#8216;key&#8217; with empty &#8216;value&#8217; ???
Last modified: August 18, 2016

---

# Custom fields: Using ‘key’ with empty ‘value’ ???

 *  [Jack](https://wordpress.org/support/users/moxie/)
 * (@moxie)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/custom-fields-using-key-with-empty-value/)
 * Hope I can explain this correctly: Until now I had made 4 extra categories (like‘
   interactive’, ‘sound’ etc.). These were not actual main categories but I used
   them to indicate if a post was something to read, hear, view or do. For this 
   I have 4 little icons that, by assigning a post to one or more of these categories,
   will automatically appear next to a post, just like plugins of that kind. But
   other then in the case of the plugins that do this, my extra 4 categories aren’t‘
   real’.
 * This works ok, but I’m alway having difficulty of excluding those 4 categories
   from all kinds of listings and, especially, all sorts of plugins I use.
 * Therefore I was experimenting with the custom fields. This also works, by using
   4 custom fields with the same names as previously the categories. So when adding
   a post, I also add one or more of those custom fields. But it’s not really userfriendly
   because I also have to add something (doesn’t matter what) to the ‘values’ field,
   otherwise the custom field will not be excepted by wordpress.
 * Any idea of changing this or some other suggestion? At this moment I’m using 
   this code:
 * `$extravelden = get_post_custom_keys();
    $aantalvelden = count($extravelden);
   if ($aantalvelden != 0) { for ($i=0;$i<=$aantalvelden;$i++) { echo "<img src=\"
   plaatjes/".$extravelden[$i].".gif\" alt=\"\" />"; } }

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [Jack](https://wordpress.org/support/users/moxie/)
 * (@moxie)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/custom-fields-using-key-with-empty-value/#post-243611)
 * No one? 🙁
 * In short my question was: When adding a custom field, can I just add the ‘key’
   without giving it a ‘value’?
 *  [Joshua Sigar](https://wordpress.org/support/users/alphaoide/)
 * (@alphaoide)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/custom-fields-using-key-with-empty-value/#post-243612)
 * Learn from the plugin “Adhesive.”
 * [http://redalt.com/downloads/](http://redalt.com/downloads/)
 *  Thread Starter [Jack](https://wordpress.org/support/users/moxie/)
 * (@moxie)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/custom-fields-using-key-with-empty-value/#post-243613)
 * I looked at the code of this plugin and understand what’s it doing. It adds a
   value of ‘1’ to the meta-key ‘sticky’. So it’s not possible to just use a meta-
   key without adding a value. WordPress will not accept that and will not save 
   the custom field.
 * I can see that it should be possible to make some default custom fields, all 
   with the value of 1, if they are checked in the ‘write post’ screen, just like
   the sticky. But I’m afraid that’s over my head. I don’t see how I can make something
   like that myself. 🙁
 * But thanks for the tip.
 *  [amory](https://wordpress.org/support/users/amory/)
 * (@amory)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/custom-fields-using-key-with-empty-value/#post-243619)
 * check out [post_keywords](http://bluewebpages.com/downloads/post_keywords.phps),
   written by Ryan Boren, modified slightly for 1.5 by myself. it will add an extra
   input field for a “keyword” field. It is in essence apart of the custom field
   setup, as its value gets saved in the postmeta table (dont remember the exact
   name). It probably can be easily modified to add multiple inputs or change the
   fields name from keyword to “type” or “kind” …
 *  Thread Starter [Jack](https://wordpress.org/support/users/moxie/)
 * (@moxie)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/custom-fields-using-key-with-empty-value/#post-243620)
 * I really appreciate all the tips, … but I’m not so into php and mysql to see 
   how I could use it to create my own thing. And this plugin by rboren is something
   I’m already using as a customfield. But what I would want is to create a few 
   custom fields that I don’t need to fill in, but that have checkboxes above the
   post editing screen, just like when you’re using ‘sticky’ or ‘adhesive’ of ‘runphp’
   plugin. Checking one checkbox ‘activates’ that custom field.
 * In short I would like this: Above the post 4 checkboxes: ‘sound’, ‘movie’, ‘interactive’
   and ‘enlarge’. These are not categories but more characteristics of that post.
   Clicking ‘interactive’ would cause a small if-statement in the indexpage to place
   a small icon of a mouse next to the title. If you visit my site you can see what
   I mean. But now I’m using 4 categories and I don’t want that anymore.
 *  [amory](https://wordpress.org/support/users/amory/)
 * (@amory)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/custom-fields-using-key-with-empty-value/#post-243629)
 * let me see what i can come up with
 *  Thread Starter [Jack](https://wordpress.org/support/users/moxie/)
 * (@moxie)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/custom-fields-using-key-with-empty-value/#post-243630)
 * I would really appreciate that. Just hope I was clear enough about what I’m looking
   for :). Therefore one little addition to the above:
    When clicking that checkbox
   means an icon will appear next to the post title that will inform the visitor
   that sound has been added to that post, or that the thumbnail can be enlarged,
   or that it contains a moviesample, or that it contains some interactive element.
   So it’s kind of saying what properties a post has, other than saying to which
   category it belongs. Could be a hint for a very usefull plugin 🙂 🙂
 * One example that has a combination of two of those options is this post:
    [http://www.spoenk.nl/weblog/?p=32](http://www.spoenk.nl/weblog/?p=32)

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Custom fields: Using ‘key’ with empty ‘value’ ???’ is closed to new replies.

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 3 participants
 * Last reply from: [Jack](https://wordpress.org/support/users/moxie/)
 * Last activity: [20 years, 10 months ago](https://wordpress.org/support/topic/custom-fields-using-key-with-empty-value/#post-243630)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
