Hello, I am trying to pass an ACF field value into another plugin’s shortcode. Essentially trying to place a shortcode within a shortcode. See the code below:
[mbhi_ifopen location=”[acf field="city" post_id="34"] – Pharmacy”]
<div class=”dropdown”>
Test
</div>
[/mbhi_ifopen]
[mbhi_ifclosed location=”[acf field="city" post_id="34"] – Pharmacy”]
I am unable to successfully do this. And insights or thoughts would be much appreciated!
You cannot use a shortcode as an attribute of another shortcode, for that matter you cannot use a shortcode as an attribute value of anything. This is built into WP and has nothing to do with either plugin.
The only way to do this is by building a PHP filter for the shortcode of the other plugin if the other plugin is build sho that the attiutes are filterablevia this hook shortcode_atts_{$shortcode}.
This works only if the other plugin’s shortcode calls shortcode_atts() and passes the shortcode name in the call (optional 3rd argument). I have not looked at the code of the other plugin to see if this is the case.