Created
March 17, 2022 15:37
-
-
Save koen12344/06fcd35fee1f5583d2b006c8331c9ac3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function pgmb_add_acf_fields($variables, $parent_post_id){ | |
//Check if the ACF get_fields function is actually available | |
if(!function_exists('get_fields')){ return $variables; } | |
$fields = get_fields($parent_post_id); | |
if($fields){ | |
foreach($fields as $name => $value){ | |
$variables["%acf_{$name}%"] = $value; | |
} | |
} | |
return $variables; | |
} | |
add_filter('mbp_placeholder_variables', 'pgmb_add_acf_fields', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment