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 | |
add_filter('acf/load_field/name=field_name', function($field) { | |
// variant 1 | |
$field['default_value'] = 'FOO'; | |
// variant 2 (does not work anymore) | |
// use get_post_meta instead of get_field to avoid conflicts | |
global $post; | |
if( get_post_meta($post->ID, 'field_name', true) == '' ) { |