Support

Account

Forum Replies Created

  • @jsilver,

    Excuse me mate, I didn’t really completely read your response or go to your article on the external site! My bad!

    Anyhow, my post describes what is needed in the admin, even without using an obsolete plugin for it. Should be interesting for devs just needing this in the admin.

  • David,

    For the acf/validate_save_post action this can easily be done, without “hacking”, using the built in edit_form_after_title action and add a hidden input field with the acf[post_id] name.

    The AJAX post on the post edit screen will serialize all acf named inputs, so in this way, you can easily use the post_id in one of your own acf/validate_save_post hooks. 🙂

    
    // acf/validate_save_post
    add_action( 'edit_form_after_title', 'devplus_edit_form_after_title' );
    function devplus_edit_form_after_title(){
    	global $post;
    	if( $post && isset( $post->ID ) ){
    ?>
    	<input type="hidden" name="acf[post_id]" value="<?php echo $post->ID; ?>" />
    <?php
    	}
    }
    

    Happy ACF coding!

    // T

Viewing 2 posts - 1 through 2 (of 2 total)