Support

Account

Home Forums Backend Issues (wp-admin) Multisite

Solved

Multisite

  • I have seen a few threads about multisite but not a definitive solution. Is there a way (either built-in or a modification) to use the same fields across all sites on a multisite network?

  • Hi @refreshingdesign

    This is something I am yet to test with ACF.

    Perhaps you could test the waters on this one?

    I believe there is some sort of ‘satellite’ or ‘broadcast’ plugin which you can use to send the data between sites.

    Also, there is the export to PHP feature within ACF which you can then use to register fields via code. I’m sure you could find a way for the individual sites to all load from the same file!

    Good luck
    E

  • PHP export worked flawlessly. Simple steps for anyone else who comes across this thread:

    1) Network Activate Advanced Custom Fields
    2) Create Field Groups on the Main Site through the Custom Fields Menu.
    3) Use Custom Fields –> Export, select all field groups, Export to PHP
    4) Paste the PHP into your (child) theme’s functions.php
    5) Go back and trash the fields from the main site so there aren’t duplicates.

    You now have ACF fields available network-wide.

  • This reply has been marked as private.
  • Elliot, can I test this for you?

  • Hi @splitmango

    Not sure what ‘test’ you are referring to, but yes, please do!

    Thanks
    E

  • Just to add to this.

    5) Go back and trash the fields from the main site so there aren’t duplicates.

    I found instead of deleting the original fields i just put the outputted php in this if statement:

    global $blog_id;
    if ($blog_id != 1) {
      //Output here.
    }
    
  • @refreshingdesign Unfortunately I am not able to get fields working with your method. I only get my fields on my first installation when not deleting the original fields, the second site doesn’t have any fields available, neither in the editable field groups nor in the places the custom fields should appear. Does this method still hold true for WP 3.9?

    Here is what I did:

    1. Had a ‘normal’ WP installation, produced custom fields, used them, fine.
    2. Turned it into a multisite installation. All fine, fields still active for the first site.
    3. Exported the fields to PHP.
    4. Inserted the PHP into my functions.php.
    5.a Trashed fields: I have no fields available anymore.
    5.b Don’t trash fields: Fields stay active in first site, second site has no fields.

    Is there anything I am missing here :)?

    Thanks in advance

    physalis

  • Hi Physalis,

    Just to rule it out in case, do you have ACF activated network wide or just on the main blog ?

    Cheers
    -Harry

  • Hi @hparton,

    both the main plugin and the options page addon are activated network wide :).

    Cheers

    physalis

  • Hmm not sure whats wrong then, i currently have a multisite setup with custom fields working on WP 3.9 so it is definitely still compatible.

    Although i have mine in a plugin instead of my functions.php file, you could try that ?

    Cheers
    -Harry

  • I finally found the problem, and it obviously didn’t have anything to do with ACF. For some reason, I had a mixup with a (local) capital letter in my theme name, so it wouldn’t recognise any of my changes, since it landed in the wrong folder (e.g. wp-content/themes/Themename instead of wp-content/themes/themename). Now everything seems to be working smoothly, and the solution above is working well :).

    Thank you anway for your fast help :). It did help me to look deeper.

  • Hey, I’ve released a plugin that can copy your fields to all of your multisite installations with just one click. Take a look at ACF Multisite Sync!

  • Once I need it again I’ll be glad to check it out, thanks Philipp ;).

  • I found this solution:

    http://seanbutze.com/automated-exporting-for-advanced-custom-fields/

    but it won’t work with the acf v5.
    I think this could be a good starting point for a definitive solution.

  • The php export solution posted by refreshingdesign worked perfectly for me. It will be a great time saver for me and my users do not have to worry about setting up or formatting pages.

    Thanks for the post.

  • Hi there,

    I’m having the same issue here. The plugin is network activated, and works fine on the first site, but then I export the PHP and paste it into my functions.php file, and nothing happens on the other sites. I’ve tried hooking into init too, but had no luck.

    I’m using ACF v. 4.1.1

    Here is the code:

    if(function_exists("register_field_group"))
    {
    	register_field_group(array (
    		'id' => 'acf_portfolio',
    		'title' => 'Portfolio',
    		'fields' => array (
    			array (
    				'key' => 'field_588e77e6e4801',
    				'label' => 'CMS',
    				'name' => 'cms',
    				'type' => 'text',
    				'default_value' => '',
    				'placeholder' => '',
    				'prepend' => '',
    				'append' => '',
    				'formatting' => 'html',
    				'maxlength' => '',
    			),
    		),
    		'location' => array (
    			array (
    				array (
    					'param' => 'post_type',
    					'operator' => '==',
    					'value' => 'portfolio',
    					'order_no' => 0,
    					'group_no' => 0,
    				),
    			),
    		),
    		'options' => array (
    			'position' => 'normal',
    			'layout' => 'no_box',
    			'hide_on_screen' => array (
    			),
    		),
    		'menu_order' => 0,
    	));
    }

    Thanks!

  • This reply has been marked as private.
  • I feel like I’m sooo close to making this work but I can’t figure out how to make the location “value” be the title of a page instead of the ID.

    Would anyone know how I could set the location to be something like this

    
    'location' => array(
    		array(
    			array(
    				'param' => 'page',
    				'operator' => '==',
    				'value' => 'Name of Page',
    			),
    		),
    

    Instead of something like this?

    
    'location' => array(
    		array(
    			array(
    				'param' => 'page',
    				'operator' => '==',
    				'value' => '218',
    			),
    		),
    

    Thank you!

    ACF version 5.6.10

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

The topic ‘Multisite’ is closed to new replies.