Support

Account

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;
    
    }