Home Forums General Issues Using field data in shortcode Reply To: Using field data in shortcode

  • Hey @Tintin,

    You’ll want to create a variable for your string then use a concatenated string ->

    $idcode = get_field('id_code');
    echo do_shortcode('[shortcode id="'.$idcode.'"]');

    You could also skip the variable all together and just use the get_field function inline.

    echo do_shortcode('[shortcode id="'.get_field('id_code').'"]');

    Hope that helps. 🙂

    EDIT: Added inline function option.