Support

Account

Home Forums ACF PRO Network Multisite: use meta not working in multisite Reply To: Network Multisite: use meta not working in multisite

  • Hi @developeronetest

    Yeah the thing about users and WPMU is that while WordPress creates own tables for pretty much everything it does not create separate tables for wp_user and wp_usermeta. So when you have meta on a user it will be applied to the entire network.

    I think that this is not just an issue of wether it’s possible for ACF to add support for separate meta but also wether this is wanted. I can see use cases both where one would want separate meta AND network wide meta.

    But of course I’ll try to help you out.
    I think you might be able to achieve this by modifying the field names specifically for each site. If you register your user meta fields manually with PHP you can pass in the sites ID to get the same results as with wp_capabilities etc.

    Then when you want to fetch the user meta you’ll do the same. pass in the current sites ID in the field name.
    Here’s some example code of what I mean:

    
    if( function_exists('acf_add_local_field_group') ):
    $site_ID = get_current_blog_id();
    acf_add_local_field_group(array(
    	'key' => 'group_1',
    	'title' => 'My Group',
    	'fields' => array (
    		array (
    			'key' => 'field_1_' . $site_ID,
    			'label' => 'Sub Title',
    			'name' => 'sub_title_' . $site_ID,
    			'type' => 'text',
    		)
    	),
    	'location' => array (
    		array (
    			array (
    				'param' => 'post_type',
    				'operator' => '==',
    				'value' => 'post',
    			),
    		),
    	),
    ));
    
    endif;
    
    //And fetching anywhere in your theme
    
    $site_ID = get_current_blog_id();
    $userfield = get_field('sub_title_' . $site_ID, 'user_' . $user_ID);