Hello,
I am confused as this is either by design; the documentation is wrong; or a bug waiting to be fixed.
acf/update_value filter states that:
This hook allows you to modify the value of a field before it is saved to the database.
But, when you actually use get_field()
function inside that filter using the same selector, the get_field()
will actually output the submitted value, which in a sense is already saved in the database, right?
Example:
add_filter( “acf/update_value/key=field_123456”, ‘cb_try_to_get_field_this’, 10, 3 );
function cb_try_to_get_field_this( $value, $post_id, $field ) {
$the_value_of_the_post = get_field( ‘field_123456’, $post_id );
error_log( print_r( $the_value_of_the_post, 1 ), 3, “debug.log” );
return $value;
}
and you’ll be able to see that $the_value_of_the_post
actually returned the submitted/new values.
how come?
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.