Home Forums General Issues Shortcode not working in Widget Reply To: Shortcode not working in Widget

  • In order to get custom fields for widgets using a shortcode you’d need to specify the correct post id. In this case is would be something like widget_' . $widget_id), so you’d need to include the id in the shortcode.

    See the shortcodes doc here and document on getting values from fields attached to shortcodes here

    I don’t know how you’d know what the actual ID of the widget it when editing the widget and this is only a guess. If I save the widget and then inspect the code it has an id that looks something like this widget-14. I suspect, but would have to test, that the ID value of the widget that I’d need to use for ACF is 14