Support

Account

Home Forums ACF PRO Database upgrade for multisite Reply To: Database upgrade for multisite

  • @adrian-b

    You likely already have this solved but since I had the same issue I wanted to explain my solution.

    Please note I am not a programmer and this was just to fix this for my needs.

    In /advanced-custom-fields/admin/install-network.php on line 257 there is reference to the function get_sites():
    $_sites = get_sites();

    This function has a default value of 100 unless otherwise specified. Source: https://developer.wordpress.org/reference/functions/get_sites/

    If you replace line 257 with the below, you have more control over how many sites can be listed by the updater.

    $_sites = get_sites( 
    		[
    			'public'  => 1,
    			'number'  => 500,
    			'orderby' => 'id',
    			'order'   => 'ASC',
    			// 'offset'   => 500,
    		]
    );

    This will change the number of sites loaded from the default of 100 to 500. If the page shows a blank, you can lower this number. You can also raise it if your server settings can handle more.

    In your case you were getting a “Sorry, you are not allowed to access this page.”-type message. For me, I overrode the checker on line 45 from:
    $prompt = false;
    to
    $prompt = true;

    If you are not able to load all of your sites still, you can use the “offset” parameter to set which site the function will begin with. For example, the above will run the first 500 sites, uncomment the “offset” line and it will do 500-1000. Change to 1000 and it will then run 1000-1500.

    Once your updates are done you can undo the above changes.

    Hope this helps anyone else searching for an answer.