Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Basically, I need to alter the info the user inputs into an advanced custom fields textbox before it is written to the database but I don't know how to grab it. I can only get it after it has been written to the meta portion of the database by using get_field().

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Edit - This answer is no longer accurate for the current version of ACF, see their documentation

Use the acf_save_post hook. See Hooks & Filters in Advanced Custom Fields documentation.

function my_acf_save_post( $post_id )
{
    // vars
    $fields = false;

    // load from post
    if( isset($_POST['fields']) )
    {
        $fields = $_POST['fields'];
    }

    // ...
}

// run before ACF saves the $_POST['fields'] data
add_action('acf_save_post', 'my_acf_save_post', 1);

// run after ACF saves the $_POST['fields'] data
add_action('acf_save_post', 'my_acf_save_post', 20);
share|improve this answer
    
works perfectly, thanks! –  tyler Sep 24 '12 at 14:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.