I have created some custom fields using ACF.
I am displaying one of those custom fields inside the content builder using this shortcode I made:
// Add Shortcode
function shortccode_14_eyes() {
if ( get_field( 'privacy_fourteen_eyes_country' ) ):
return '<span style="color:#EE121E;"><i class="fa fa-exclamation-triangle"></i></span>';
endif;
}
add_shortcode( '14_eyes', 'shortccode_14_eyes' );
If the field privacy_fourteen_eyes_country
is true
, it will display a font awesome icon.
The problem is that the icon is displaying even when the custom field has a false
value. The icon shows no matter what value the field has (true or false).
I thought maybe my code was wrong so I tested it using https://wordpress.org/plugins/custom-content-shortcode/ which generates shortcodes for ACF. It has the exact same problem. The icon shows no matter what value the field has.
I’m having a really frustrating and wasteful day trying to get this working. Do you know what is going wrong?
Here is the settings page for my ACF field: http://nimb.ws/RFKukJ