Support

Account

Home Forums General Issues Dynamically registered (via PHP) relationship fields return no results Reply To: Dynamically registered (via PHP) relationship fields return no results

  • Aaand 10 months later I stumbled on this bug again.

    I’m registering fields dynamically:

    
    foreach( $levels as $i => $level ) {
        $name = "level_{$level->term_id}_winner";
    
        acf_add_local_field([
            'parent'        => 'group_5cb57c19cffde',
            'key'           => "field_{$name}",
            'label'         => sprintf( __( '%s level winner', 'imatch' ), $level->name ),
            'name'          => $name,
            'type'          => 'post_object',
            'post_type'     => [ 'im_registration' ],
            'taxonomy'      => [],
            'allow_null'    => true,
            'return_format' => 'id',
        ]);
    }