Support

Account

Forum Replies Created

  • Here is the whole code:

    // Change Field into a select
    $field['type'] = 'select';
    $field['ui'] = 1;
    $field['ajax'] = 1;
    $field['choices'] = array();
    
    // get sites
    $sites = $this->acf_get_sites();
    
    // set choices
    if( !empty($sites) ) {
    
    	foreach( $sites as $site ) {
    		
    		//get blog name
    		$current_blog_details = get_blog_details( array( 'blog_id' => $site['blog_id'] ) );
    		
    		// append to choices
    		$field['choices'][ $site["blog_id"] ] = $current_blog_details->blogname;
    
    	}
    
    }
    
    // render
    acf_render_field( $field );

    Its almost the same like the post_object. I have no JS errors. Without ui and ajax its just fine.

  • It was my bad. Sorry. Code works like charm.

Viewing 2 posts - 1 through 2 (of 2 total)