Skip to content

Instantly share code, notes, and snippets.

@asha23
Created February 13, 2017 10:59
Show Gist options
  • Save asha23/fb622c50195a34e3303ec467db9de139 to your computer and use it in GitHub Desktop.
Save asha23/fb622c50195a34e3303ec467db9de139 to your computer and use it in GitHub Desktop.
Advanced Custom Fields Flexible Content Type Rename Title
function my_layout_title($title, $field, $layout, $i) {
if($value = get_sub_field('layout_title')) {
return $value;
} else {
foreach($layout['sub_fields'] as $sub) {
if($sub['name'] == 'layout_title') {
$key = $sub['key'];
if(array_key_exists($i, $field['value']) && $value = $field['value'][$i][$key])
return $value;
}
}
}
return $title;
}
add_filter('acf/fields/flexible_content/layout_title', 'my_layout_title', 10, 4);
@jupago
Copy link

jupago commented Nov 15, 2018

Thanks for putting this together! Got me out of trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment