Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The title pretty much says what I'm trying to accomplish, but more specifically I have a plugin that I made and it creates a custom post type, lets call them newpages. On these pages I have used template_redirect to take over the design of the pages, but some plugins appear, but I don't want to remove all of the plugins from loading, just a couple.

So I was wondering if it's possible to use something like custom fields to disable certain plugins on a per-post basis. Can anybody point me in the right direction? Thanks!

share|improve this question
    
It really depends on what are the plugins? –  Bainternet May 11 '11 at 21:54
    
That's the thing, it will vary. I want to somehow make an array with all of the plugins that are currently activated and to be able to deactivate some of them per-post. I'll be deactivating them by adding a section in my meta box on the post editor that will add/change custom fields to do this. –  Jared May 11 '11 at 23:03

2 Answers 2

up vote 2 down vote accepted

I don't see why not.

  1. Hook to template_redirect (you already did).

  2. Conditionals should work at this point, so use is_single() / is_singular() / etc to check for what you need.

  3. Use remove_action()/remove_filter() to unhook unwanted functionality.
share|improve this answer
    
thanks for that, it clears up some things but I'm a bit confused as to how I would go about applying it. There are many plugins installed, I basically want to add a section in my meta box for the post editor where I can select/deselect specific plugins to activate/deactivate them for that specific post. Is this what you are describing above? In other words, I would probably need an array with all the plugin names to toggle them per post with a meta box and custom fields. –  Jared May 11 '11 at 23:00
1  
@Jared this is essentially describing more mild way to do it - you need to know what plugins are doing and what functionality they are hooking for that. Really not loading plugin conditionally would be much more complex. –  Rarst May 12 '11 at 6:34

I was interested in accomplishing something like this before. There is a plugin named Plugin Organizer that I came across. It allows you to change the order that plugins are loaded and selectively disable them on a post types or page url basis. You can find it in the WordPress plugin directory.

share|improve this answer

Your Answer

 
discard

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.