PHP WordPress - Load your plugin first

<?php /** * Move your plugin to the start of the line */ function make_my_plugin_first( $plugins ) { $basename = plugin_basename( __FILE__ ); if ( $key = array_search( $basename, $plugins ) ) { unset( $plugins[ $key ] ); array_unshift( $plugins, $basename ); } return $plugins; } add_filter( 'pre_update_option_active_plugins', 'make_my_plugin_first' ); add_filter( 'pre_update_option_active_sitewide_plugins', 'make_my_plugin_first' ); /** * Move your plugin to the end of the line */ function make_my_plugin_last( $plugins ) { $basename = plugin_basename( __FILE__ ); if ( $key = array_search( $basename, $plugins ) ) { unset( $plugins[ $key ] ); $plugins[] = $basename; } return $plugins; } // @see pre_update_option_ // @link https://codex.wordpress.org/Plugin_API/Filter_Reference/pre_update_option_(option_name)

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.