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.
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.
Share Improve this question edited May 17, 2017 at 0:14 Nathan Johnson 6,5286 gold badges30 silver badges49 bronze badges asked May 16, 2017 at 21:32 FAISAL KHANFAISAL KHAN 112 bronze badges 2- 2 You have to enable a plugin on all sites to use it on all sites – Tom J Nowell ♦ Commented May 16, 2017 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 Commented May 17, 2017 at 20:34
1 Answer
Reset to default 2I 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/
Description: This is my extremely awesome WordPress plugin
Version: 1.0
Author: John Doe
Author URI: http://yourcompany
License: GPLv2
*/
to the following:
/*
Plugin Name: My Awesome Plugin
Plugin URI: http://yourplugin/
Description: This is my extremely awesome WordPress plugin
Version: 1.0
Author: John Doe
Author URI: http://yourcompany
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.