Home › Forums › ACF PRO › Detect if a field is being loaded for editing or for being displayed › Reply To: Detect if a field is being loaded for editing or for being displayed
I would most likely conditionally add the filter.
In functions.php or wherever you are adding the filter
if (!is_admin()) {
add_filter('acf/load_value/name=field-name', 'your-function-name');
}
This would mean that the filter would not be applied in the admin or during any ajax requests.
If you wanted to make it even more specific you could add the filter only just before your got the field. This would ensure that it is only applied when you want it to be applied.
add_filter('acf/load_value/name=field-name', 'your-function-name');
$value = get_field('field_name');
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!
ACF’s Repeater field is a versatile solution for repeating content in #WordPress.
— Advanced Custom Fields (@wp_acf) December 29, 2022
What’s your favorite use case for the Repeater field?
What’s the weirdest thing you’ve ever used it for?
Let us know!👇
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.