• Resolved Matheus Martins

    (@matheusfd)


    Hi guys!

    I’m developing a plugin for WordPress and now I need to enable the plugin to be used in WordPress multisites. However, I don’t want that the plugin can be used in the subsites, I want it enabled just in the master site.

    Do you have any idea in how to do this?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Super super simple ??

    In your plugin header put this:

    Network: True

    It’ll look like this:

    Plugin Name: Join My Multisite
    Plugin URI: https://halfelf.org/plugins/join-my-multisite/
    Description: Allow logged in users to add themselves to sites (or auto-add them to all sites). <strong>Settings are per-site, under the Users menu</strong>.
    Version: 1.8
    Author: Mika Epstein (Ipstenu)
    Author URI: https://halfelf.org/
    Network: true
    Text Domain: join-my-multisite

    I would also put this check (Or something like it.) in on the top of the plugin file though if it can only be used on multisite. Network true only means IF it’s on Multisite, network only.

    if( !is_multisite() ) { exit( 'This plugin only functions on WordPress Multisite.' ); }
    Thread Starter Matheus Martins

    (@matheusfd)

    Hi Mika,

    Thanks for your answer and believe, it helped me a lot. However, the plugin works this way:

    If installed in a multisite installation, it need to be activated only in the main site and can’t show anything in the subsistes. If it’s installed in a normal site, it should be possible to activate too.

    But thanks for all, I think I’m in the right way ??

    Thread Starter Matheus Martins

    (@matheusfd)

    Finished! Thanks Mika!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multisite plugin’ is closed to new replies.