I’m having trouble with my “custom meta box/write panel” script that contains radio buttons. (see below)…It currently does not seem to save the selection made after publishing the custom post type, not sure what Ive missed???

How I plan to utilize this essentially is by letting the client choose one of the radio button choices, and depending on what selection is made I will output that as a class into an anchor tag to help instantiate a specific image overlay.

Thank you for your help!

EDIT #1

Seems to be working great now, thank you for the help!
Only problem now as I mentioned is its not showing which radio button has been selected after hitting publish…(see below)

EDIT #2

Also curious how it may be possible to output the “pretty version” of each inputs value for my custom columns so that they appear like – “iTunes”, rather then “buyonitunes_album”.
EDIT #3

No big deal if this isnt possible, but is there any way to potentially make the values appear neater for the columns? ie. “freedownload_album” -> “Free”, for example. (See below)

img src=”http://i.stack.imgur.com/YnIrA.png” alt=”" />

This is how Im currently outputting the value to my columns…

Answer

The error is in you saving function where you are looking for

which is never set and should actually be

, and the use of wp_kses is not right here, if you want to validate the data and you know all of the accepted values the you can simply use in_array try:

this way the data will be saved only if the value is in the accepted “whitelist” and anything else will be avoided.

Update

to show the selected value on the backend you need to fix you metabox function which currently i have no idea what you tried to do there but here is a simple fix

Share →

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>