Support » Plugins » Hacks » How to delay a remove_action call until all other plugins are loaded

  • Resolved derekbeck


    I’m using the Simple Facebook Connect plugin, but I implement my own metadeta and don’t want the metadata from SFC.

    Short of hacking the SFC plugin itself, as I don’t want to do it everytime there’s an update, how can I call this code in my own custom plugin, but force it to run after all other plugins:


    What is the code to reserve the above until all other plugins are loaded?

    Presently, my personal site plugin for tweaks and functionality is running before SFC, and so the remove_action call is trumped later by SFC’s add_action call.


Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz


    Execute your code inside a hook to any action that fires late enough. ‘plugins_loaded’ or ‘wp_loaded’ are a couple possibilities. For extra insurance, add your hook using a low priority (bigger) number so it hopefully runs later than any conflicting hook added by another plugin.

    Unfortunately, this does not work. I hooked it to wp_footer but still, my functionality plugin loads first, so it seems irrelevant. Any other ideas?

    Okay, not ideal, but seems the simplest if not only solution is to name my plugin higher up in the alphabet than the offending plugin. Then hook exactly as that plugin is hooking. In other words, name my custom plugin to begin with a “z”, and that fixed it.

    Okay, here’s the solution:

    function PluginsOverride() {

    The key is: add whatever “remove_action”s or whatever to inside a function like above, then hook that new function to the point when plugins_loaded is done.

    Thanks to Otto, who tweeted me this solution!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to delay a remove_action call until all other plugins are loaded’ is closed to new replies.