WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a site specific plugin that I've written for the main site in my multisite network. Now I realize that the shortcodes that are in the plugin are also useful on the sub-sites, however the sub-sites don't need all the code for custom post types and taxonomies.

How do I make just the shortcodes work for sub-sites? Is there a conditional I can use? Here's how my plugin is currently set up:

// Plugin Directory 
define( 'CLICK_DIR', dirname( __FILE__ ) );

// General
include_once( CLICK_DIR . '/lib/functions/general.php' );

// Post Types
include_once( CLICK_DIR . '/lib/functions/post-types.php' );

// Taxonomies 
include_once( CLICK_DIR . '/lib/functions/taxonomies.php' );

// Shortcodes
include_once( CLICK_DIR . '/lib/functions/shortcodes.php' );
share|improve this question
up vote 3 down vote accepted
if ( is_main_site() ) {
    include_once CLICK_DIR . '/lib/functions/general.php';
    include_once CLICK_DIR . '/lib/functions/post-types.php';
    include_once CLICK_DIR . '/lib/functions/taxonomies.php';

include_once CLICK_DIR . '/lib/functions/shortcodes.php';
share|improve this answer

Put the shortcodes into a separate plugin. As a rule of thumb: use one plugin per job. Do not mix unrelated functionality just because it looks easier. It isn’t.

For WordPress the number of active plugins doesn’t matter enough to care about, just what the code does. So it is better to use 20 plugins with one line of code than one plugin for 20 different small jobs.

share|improve this answer
Good point, I'm seriously considering that now – blogjunkie Jul 6 '12 at 14:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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