Support

Account

Home Forums ACF PRO Does "post_object" field go through "acf/render_field" twice? Reply To: Does "post_object" field go through "acf/render_field" twice?

  • This lightweight solution worked for me:

    
    function my_acf_render_field( $field ) {
    	if ( did_action('acf/render_field/key=field_508a263b40457') % 2 === 0 ) {
    		return;
    	}
    
    	echo '<p>Some extra HTML for the post object field</p>';
    }
    add_action( 'acf/render_field/key=field_508a263b40457', 'my_acf_render_field' );
    

    Using the modulus division operator, the function will bail early every 2nd execution.