Home › Forums › Feedback › ACF/save_post question › Reply To: ACF/save_post question
Sadly that didn’t work.
I checked the original method inside the acf.php file and tried this as well with no results.
function my_acf_save_post( $post_id )
{
// load from post
if( !isset($_POST['fields']) )
{
return false;
}
// loop through and save
if( $_POST['fields'] )
{
$fields = $_POST['fields'];
// concert details
// event start date
//$fields['field_5217ac66687dc']
// event end date
//$fields['field_524b4ca5ff418']
if( empty( $_POST['fields']['field_524b4ca5ff418'] ) )
$_POST['fields']['field_524b4ca5ff418'] = $fields['field_5217ac66687dc'];
// calendar details
// event start date
//$fields['field_524b4c06af2a2']
// event end date
//$fields['field_524b4c3aaf2a4']
if( empty( $_POST['fields']['field_524b4c3aaf2a4'] ) )
$_POST['fields']['field_524b4c3aaf2a4'] = $fields['field_524b4c06af2a2'];
foreach( $_POST['fields'] as $key => $value )
{
// parse types
// - caused issues with saving numbers (0 were removed)
//$value = apply_filters('acf/parse_types', $value);
// get field
$field = apply_filters('acf/load_field', false, $key );
// update field
do_action('acf/update_value', $value, $post_id, $field );
}
// foreach($fields as $key => $value)
}
// if($fields)
return true;
}
I’m super stumped, which sucks sine I write code all day long.
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.
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.