• Resolved silsbyc

    (@silsbyc)


    Is there a way to enforce “Simple Mode” as the default and remove a site admin’s ability to switch this setting in a multisite?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mircea Sandu

    (@gripgrip)

    Hey @silsbyc,

    Yes you can do this by using this code which will always force set the option.

    add_filter(
    	'option_wpcode_settings',
    	function ( $settings ) {
    		if ( ! is_array( $settings ) ) {
    			$settings = array();
    		}
    		$settings['headers_footers_mode'] = true;
    
    		return $settings;
    	}
    );

    Keep in mind that we intend to build more robust access control and features for Multisite which I know will be very beneficial for administration / network wide customization.

    If you enable this code above, then you won’t see those options and won’t be aware of those new powerful features.

    So I recommend definitely checking in and keeping up with our development roadmap since we are working on some really neat stuff.

    Thread Starter silsbyc

    (@silsbyc)

    I can’t get the filter to work as a plugin or MU plugin (which is necessary since the original Insert Headers and Footers plugin was installed individually across different sites on the network).

    Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @silsbyc,

    I see, in the multisite context the option was never defined on subsites so you have to use the pre_option_ filter instead. Please use this code in a mu-plugin:

    add_filter(
    	'pre_option_wpcode_settings',
    	function ( $settings ) {
    		if ( ! is_array( $settings ) ) {
    			$settings = array();
    		}
    		$settings['headers_footers_mode'] = true;
    
    		return $settings;
    	}
    );
    Thread Starter silsbyc

    (@silsbyc)

    Thank you!

    With ‘pre_option_wpcode_settings’ the filter now works, and it continues to work the way my site admins expected it to work.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Default to Simple Mode’ is closed to new replies.