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.
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.