Support » Plugin: MathJax-LaTeX » Network install problems

  • Nagmay

    (@gabrielmcgovern)


    This is a great plugin – thank you. Unfortunately, it does not install well on WordPress networks (multisite).

    The core issue seems to be that mathjax_install() does not add the default options to individual sites when the plugin is activated network wide. Therefore, the options are not available when the shortcode tries to run. Yes, I could visit each site individually and update the options page, but our network has hundreds of sites – so, a network option page would be great!

    I quickly hacked around this by triggering mathjax_install() if the options are missing:

    	
    public static function init() {
    	register_activation_hook( __FILE__, [ __CLASS__, 'mathjax_install' ] );
    	register_deactivation_hook( __FILE__, [ __CLASS__, 'mathjax_uninstall' ] );
    
            // hack to set defaults on all sites in network
            if(!get_option('kblog_mathjax_config')){
                add_action( 'init', [ __CLASS__, 'mathjax_install' ] );
            }
            // end hack
    
  • You must be logged in to reply to this topic.