Solution for multisite plugin activation breaks the plugin
-
Hi Simon,
This has been a great plugin, but we’ve been limited to using it on our dev server. As it doesn’t work when network activating the plugin.
The issue comes from trying to verify the nonce before WP plugins have loaded. While you’ve included the pluggable file if the function doesn’t exist, it doesn’t work for multisite.
The solution is pretty simple. Just wrap the upload code in a function and hook it into plugins_loaded.
function pixabay_upload() {
if (isset($_POST[‘pixabay_upload’])) {
…
}
}add_action( ‘plugins_loaded’ , ‘pixabay_upload’ );
This works on our dev server, but for obvious reasons we can’t deploy the code to a live server.
As a bonus, you don’t need to do this, and it should be more reliable:
if (!function_exists(‘wp_verify_nonce’))
require_once(ABSPATH.’wp-includes/pluggable.php’);The page I need help with: [log in to see the link]
- The topic ‘Solution for multisite plugin activation breaks the plugin’ is closed to new replies.