0

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!

2
  • It really depends on what are the plugins?
    – Bainternet
    Commented May 11, 2011 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
    Commented May 11, 2011 at 23:03

2 Answers 2

2

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.
2
  • 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
    Commented May 11, 2011 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
    Commented May 12, 2011 at 6:34
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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