Allowing Shortcodes in Divi URLs (Buttons, Images, etc)

The Divi Theme's many modules offer a range of opportunities for adding URLs to your page. Some examples include the button module and the image module. However these are limited to the static URL you type into the modules' settings. What if you want to use be able to use URLs dynamically generated by shortcodes, e.g. a URL collected using the Advanced Custom Fields (ACF) plugin? Here's how to do it.

This is a draft tip, meaning that it hasn't been extensively tested and may not work perfectly.
It is not yet included in Divi Booster, but I hope to be able to do so in the future.

The following PHP code will search the page content for the target URLs of any button and image modules, and process any shortcodes contained within them.

With this code in place you should find that shortcodes are now processed within the "Button URL" field of the button module, and the "Link URL" field of the image module.

If there's any other URL fields you'd like to see this apply to let me know.

Want get more out of Divi?

Hundreds of new features for Divi
in one easy-to-use plugin


  1. JDar

    Actually, never mind, I got it. 🙂 Just replaced button_url with button_text in your code. Thanks!!

    • dan

      Nice one, JDar 🙂

  2. JDar

    This is great. I'd like to insert a shortcode into the button title and/or tab titles, rather than the URL. Any tips on how to accomplish that?

  3. Ensalza

    It works perfect on new Divi Version!
    Thanks for the code 😉


Submit a Comment

Your email address will not be published. Required fields are marked *