Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created July 14, 2016 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommcfarlin/02e0efe91d8f7617c60bc2857c6680ab to your computer and use it in GitHub Desktop.
Save tommcfarlin/02e0efe91d8f7617c60bc2857c6680ab to your computer and use it in GitHub Desktop.
[WordPress] Saving Empty Radio Button Values in WordPress
<div class="options">
<p>
<label>A generic label for your option.</label>
</p>
<p>
<input type="hidden" name="acme[key]" value="" />
<label>
<input type="radio" name="acme[key]" value="yes"
<?php checked( 'yes', $options['acme']['key'], true ); ?>
/>
Yes
</label>
<label>
<input type="radio" name="acme[key]" value="no"
<?php checked( 'no', $options['acme']['key'], true ); ?>
/>
No
</label>
</p>
</div><!-- .options -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment