Home › Forums › Backend Issues (wp-admin) › Duplicate Content when using acf/render_field › Reply To: Duplicate Content when using acf/render_field
I ended up solving this with a class that use a static boolean, to check if it’s already rendered or not.
class My_Custom_Field_Content {
private static $rendered = false;
public static function render() {
if (self::$rendered === true) {
// ignore rendering
return;
}
self::$rendered = true;
echo 'Well, hello there!';
}
}
add_action('acf/render_field/key=field_123xyz', My_Custom_Field_Content::class . '::render' );
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.