Home › Forums › ACF PRO › Retrieving option throws massive error › Reply To: Retrieving option throws massive error
Thanks for the reply John. I can understand the infinite loop, but I don’t quite understand where or which filter this is ? AFAIK I have no filter for that field.
I retrieve the value in a function and call that function within pre_get_posts and on other places.
function sd_exclude_dummy() {
// $hide_dummy = 1; // 0 for all, 1 show for admins
$hide_dummy = get_field( 'sd_hide_dummy_profile', 'option' ); // creates issues
$dummy_profile = get_field( 'sd_dummy_profile', 'option' );
$exclude = array();
if ( false != $dummy_profile ) {
// a dummy post is 'set'
if ( ! current_user_can( 'manage_options' ) ) {
// non-admin, so always exclude it
$exclude[] = $dummy_profile;
} else {
if ( $hide_dummy == 0 ) {
$exclude[] = $dummy_profile;
}
}
}
return $exclude;
}
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.