WordPress Plugin Execution Order

I just spent the last few hours trying to figure out what was wrong with my new WordPress plugin. My plugin requires another plugin and what was happening was WordPress was running my plugin first. This was the source of the problem and it took me awhile to figure that out. Then I had to figure out how to force WordPress to run my plugin first. I tried a code solution but there isn’t any way to tell WordPress in the code to run one plugin before the other. Then I tried modifying their order in the database but WordPress kept rewriting the row I would change. So then I thought, alphabetical ordering. I don’t want to have to rename my plugin just because of some stupid limitation of the WordPress plugin architecture. I noticed that it was running the plugins that had their own subdirectories first and then it would execute plugins that were just single files inside the plugins directory. Bingo. I removed the directory I had put my plugin from and just dumped it right in the plugins directory. Now it works beautifully. It was troubling me because I already had the plugin working on another blog (before I made the subdirectory modification) and was scratching my head why it wasn’t working here. Its all simple in retrospect.

  • david

    Any plans to make this plugin do the same for furl, digg, reddit, etc?

    If not, what would I need to add to the code to make it go?

    Thanks for a useful plugin!

  • http://www.brianmcquay.com admin

    I started to but found that a lot of the social bookmarking sites offer the ability to import your bookmarks from delicious so I’ve been doing that manually every so often. I’ve got a ton of other projects I’ve been working on lately so I don’t have any immediate plans to integrate it with other sites. It would be a good idea though. This plugin drives a plenty of traffic to the sites I use it with.

    To get it working with other sites you’d need to first get it to login and then submit the new post the same way its currently written for delicious. Delicious publishes an API which made writing the plugin easy. I’ll work with you on making it work for these other sites if you want.

  • david

    Great — thanks for the email and for getting back to me. I started looking for something like this earlier today when I got an ad by email offering a plugin that does much the same for over $100. I thought, this is an awesome idea, but surely this can’t be that hard to do. So I was just reading the delicious API when I heard back from you. I’m under a pile of projects myself, but I’ll get to work on this later in the week and get back to you when I get stuck.

    It would be very cool to autobookmark posts to a dozen sites as soon as you hit the publish button — talk about traffic!

  • david

    OH — too cool — OnlyWire.com does it all, so I’ll just rework your plugin for that one, and it does the rest. Thanks again!

  • http://reveloper.com Adrian Salceanu

    Hi,

    I had the same problem so finally I decided to create a plugin to easily set the plugins load order.

    Works for WordPress > 3

    Enjoy!

    http://reveloper.com/blog/wordpress-plugins-order-plugin/

  • http://www.brianmcquay.com admin

    Thanks for the plugin! I remember this being a pretty big pain back when I first discovered it. Its amazing this hasn’t been built into the WordPress core considering how critical the execution order is. I would recommend you try to get this put into the WordPress core now that you’ve got the plugin. Something as critical to the successful operation of WordPress and plugins like the plugin load order ought to be included out of the box in my opinion. Great work!