Support

Account

Home Forums Front-end Issues Shortcodes in text field Reply To: Shortcodes in text field

  • no, both of these ‘solutions’ are needlessly complex and add_filter might be a potential security risk across every field rather than just the one you want to use

    a text field is plain text, therefore it can be directly utilized in php, which is what get_field() is for, rather than the_field() that wraps the data into its own echo function

    so it’s simply do_shortcode( get_field('FIELDNAME') );

    of course the best practice in case there’s no data and if there’s extra html around it is to check if it exists first

    if ( get_field('FIELDNAME') ) {
    	echo do_shortcode( get_field('FIELDNAME') );
    }