Skip to content

Instantly share code, notes, and snippets.

@nicmare
Last active January 30, 2023 06:31
Show Gist options
  • Save nicmare/3564411aef5353c2d6f3f96c27d1a86b to your computer and use it in GitHub Desktop.
Save nicmare/3564411aef5353c2d6f3f96c27d1a86b to your computer and use it in GitHub Desktop.
simple function to place acf field values where ever needed in content
<?php
function acf_get_field_shortcode($args = array()){
if(!function_exists("get_field")) return "";
$field = (isset($args["field"]) && !empty($args["field"]))?get_field($args["field"]):false;
if($field) return $field;
return "";
}
add_shortcode("acf_get_field","acf_get_field_shortcode");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment