Skip to content

Instantly share code, notes, and snippets.

@koen12344
Created March 17, 2022 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koen12344/06fcd35fee1f5583d2b006c8331c9ac3 to your computer and use it in GitHub Desktop.
Save koen12344/06fcd35fee1f5583d2b006c8331c9ac3 to your computer and use it in GitHub Desktop.
<?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