Hey,
I’m using a generatepress Custom Hook as a shortcode using this function:
function customFunc($atts, $content = null) {
ob_start();
do_action('customHook');
return ob_get_clean();
}
add_shortcode('myShortcode', 'customFunc');
This shortcode works OK in my pages but it is returning empty when I try to save its value into a variable in Ad Inserter:
$code = do_shortcode('[myShortcode]');
That means $code is always empty even if the shortcode works ok in my posts. Why is this happening?