Home › Forums › General Issues › How do I use acf/load_value correctly? › Reply To: How do I use acf/load_value correctly?
Hi Elliot thanks for the heads-up and first-class support.
For those that are interested, I resolved my issue with the following code:
function MY_FUNCTION_NAME( $value ) {
if ( !$value ) : // IF VALUE EMPTY, RETURN NEW VALUE
$value = get_field( 'MY_CUSTOM_FIELD_NAME', $POST_ID) );
return $value;
endif;
return $value; // RETURN EXISTING VALUE
};
add_filter( 'acf/load_value/name=MY_CUSTOM_FIELD_NAME', 'MY_FUNCTION_NAME' );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.