Skip to content

Instantly share code, notes, and snippets.

@scarstens
Created December 20, 2014 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scarstens/df486e158eee33b5e006 to your computer and use it in GitHub Desktop.
Save scarstens/df486e158eee33b5e006 to your computer and use it in GitHub Desktop.
Use this in your plugin to make sure it loads last
function my_plugin_load_last()
{
$path = str_replace( WP_PLUGIN_DIR . '/', '', __FILE__ );
if ( $plugins = get_option( 'active_plugins' ) ) {
if ( $key = array_search( $path, $plugins ) ) {
array_splice( $plugins, $key, 9999 );
array_unshift( $plugins, $path );
update_option( 'active_plugins', $plugins );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment