Support

Account

Home Forums Bug Reports Issue with get_field function in acf/update_value filter

Unread

Issue with get_field function in acf/update_value filter

  • Having an odd issue with get_field reurning an empty string when called inside an update filter add_filter( 'acf/update_value/name=field-name', array($this, 'acf_hash_password_field'), 10, 3); it seems the get_field function will only ever return an empty string but if I use get_post_meta I’m able to get the actual value stored in the database.

    
    public function acf_hash_password_field( $value, $post_id, $field ) {
    	if ( !empty($value) ) {
    		$return_value = wp_hash_password($value);
    	} else {
    		* Get field returns an empty string *
    		$return_value = get_field('field-name', $post_id);
    		* get_post_meta returns the value stored in the DB *
    		$return_value = get_post_meta( $post_id, 'field-name', true );
    	}
    	return $return_value;
    }
    
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.