I'm trying to find how to intercept the values in some custom fields on a page when they are being saved. I have searched and found out how to add a hook to the functions file to get the standard content fields, but so far haven't worked out how to do the same for custom fields. I'm using ACF Pro with flexible content fields, so the actual values come through as mutli-dimensional arrays.
The code that I am using is at the bottom. This code successfully modifies the standard 'post_content' field before saving. Basically I want to do the same for various custom fields. Any ideas?
function save_my_post( $content ) { global $post; if( isset($post) && get_post_type( $post->ID ) == 'post' ){ $content['post_content'] = function_to_manipulate_the_content(); } return $content; } add_filter( 'wp_insert_post_data', 'save_my_post' );