Home Forums Bug Reports Repeater field in multisite with php import Reply To: Repeater field in multisite with php import

  • If the PHP code is specifically for “SITE B” and the PHP code is not run when the “MAIN SITE” or “SITE A” is being viewed, then the field group does not exist, it’s not set up. Since the field group and the fields do not exist ACF does not know that the field you are trying to get is a repeater field, when ACF gets the field key for the field you are getting there is no field that matches that key. Since ACF can’t figure out what to do with the value it assumes that the value is a simple text value and returns the value that is actually stored for the postmeta of the repeater field name. Using swith_to_blog() does not run PHP code specific to that blog, it just changes what table in the database that WP gets data from.

    Hopefully that helps those that are looking understand why the issue exists. It’s not something that can be fixed without doing a little work.

    If you want to be able to access data in fields for all sites on a multisite install then the fields must be defined in all sites. This can be accomplished in several ways, the OP gave one way.

    1) You could create a plugin that is activated for all sites or even a must use plugin and in that plugin you set up the field groups using PHP.

    2) You could place the JSON files in the “MAIN SITE” acf-json folder and define a second load point

    3) You could create a plugin that includes JSON files and set a second load point to a folder inside the plugin.

    I’m sure there are other possibilities.