1

I have a multisite project in which I have WordPress networked multi site.

In my site I have many of the plugins like photo gallery, video gallery, and widget.

I have created shortcode and I use them in the first site. But in other site it is not working. So I wanted to know the solution. How I can use the same shortcode for all the website?

My all website theme is same.

  • 2
    You have to enable a plugin on all sites to use it on all sites – Tom J Nowell May 16 '17 at 21:43
  • @Tom is correct. The plugin must be enabled on all sub-sites or it won't work on that sub-site. (Been there, done that, spent several days before the "Doh!' moment.) – Rick Hellewell May 17 '17 at 20:34
1

I suggest you to create a Network-only plugin that is Active for all the sites in the network and define your shortcodes inside.

To make specific plugin Network-only you need to add Network: True to your plugin definition, just like the example below.

Change:

/*
Plugin Name: My Awesome Plugin
Plugin URI: http://yourplugin.com/
Description: This is my extremely awesome WordPress plugin
Version: 1.0
Author: John Doe
Author URI: http://yourcompany.com
License: GPLv2
*/

to the following:

/*
Plugin Name: My Awesome Plugin
Plugin URI: http://yourplugin.com/
Description: This is my extremely awesome WordPress plugin
Version: 1.0
Author: John Doe
Author URI: http://yourcompany.com
License: GPLv2
Network: True
*/

After this is done make sure you activate your plugin from the Network Admin and the shortcodes defined in your plugin should work on all the sites in the network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.