Support

Account

Home Forums Front-end Issues Why can't I retrieve checkbox values?

Solved

Why can't I retrieve checkbox values?

  • I have no problem retrieving content from every other field type, but for the life of me I am not able to pull the value of selected checkboxes.

    I have a checkbox “mobile_service” that contains two options. Return value is set to “value”. Below is my code I’m using. On the front end all I get is empty < li > elements.

    
    		$attributes = get_field('mobile_service');
    
    		if( $attributes ) {
                echo '<ul>';
                foreach( $attributes as $attribute ) {
                    echo '<li>' . $attribute . '</li>';
                }
                echo '</ul>';
    		}
    

    It must be something very simple, very stupid that I’m missing. Can anyone help?

  • Nevermind y’all…it took posting this to figure out the (very stupid) error. A typo.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.