Support

Account

Home Forums General Issues Subheadline Text Delayed when Publishing? Reply To: Subheadline Text Delayed when Publishing?

  • @elliot

    Looking in the docs I found to use this:

    <?php
     
    function my_acf_update_value( $value, $post_id, $field  )
    {
        $value = "Custom value";
     
        // do something else to the $post object via the $post_id
     
        return $value;
    }
     
    // acf/update_value - filter for every field
    add_filter('acf/update_value', 'my_acf_load_field', 10, 3);
     
    // acf/update_value/type={$field_type} - filter for a specific field based on it's type
    add_filter('acf/update_value/type=select', 'my_acf_load_field', 10, 3);
     
    // acf/update_value/name={$field_name} - filter for a specific field based on it's name
    add_filter('acf/update_value/name=my_select', 'my_acf_load_field', 10, 3);
     
    // acf/update_value/key={$field_key} - filter for a specific field based on it's name
    add_filter('acf/update_value/key=field_508a263b40457', 'my_acf_load_field', 10, 3);
     
    ?>

    However, adding just that to my functions.php causes a bunch of errors when trying to publish a post:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'heading2' not found or invalid function name in /home/movies9/public_html/msv6/wp-includes/plugin.php on line 199
    
    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'heading2' not found or invalid function name in /home/movies9/public_html/msv6/wp-includes/plugin.php on line 199
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/movies9/public_html/msv6/wp-includes/plugin.php:199) in /home/movies9/public_html/msv6/wp-admin/post.php on line 222
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/movies9/public_html/msv6/wp-includes/plugin.php:199) in /home/movies9/public_html/msv6/wp-includes/pluggable.php on line 899

    If I just want this to effect the “heading2” custom field. How would I edit it?