WordPress.org

Forums

Advanced Custom Fields
"null" option for radio button (1 post)

  1. Eric3D
    Member
    Posted 1 year ago #

    I have radio buttons with options for "none", "small", "medium", "large" with default set to "none".
    I use conditions to display another field if the value is "small", "medium", or "large".

    if(get_field('my_field') … works as long as I don't set a value, but if I set the value to something and then go back to "none", it doesn't work anymore.

    if(get_field('my_field') != "none") ... works if the value has been set to "none", but does not work with the initial value.

    if( get_field('my_field') && (get_field('my_field') != "none") ) ... works. But I was wondering if there is a simpler option.

    https://wordpress.org/plugins/advanced-custom-fields/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic