Support » Plugin: Pixabay Images » Solution for multisite plugin activation breaks the plugin

  • Resolved slackarse

    (@slackarse)


    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’);

    • This topic was modified 1 year, 11 months ago by slackarse.
    • This topic was modified 1 year, 11 months ago by slackarse.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Simon Steinberger

    (@simonstone)

    Thanks for your advise! We’ll try to implement this in our new update that will be published later today. Sorry we didn’t see this ticket until now.

    Best
    Simon

    Plugin Author Simon Steinberger

    (@simonstone)

    Ok, just fixed it. Thanks again. Would be awesome if that fixed the multi site activation issue. I couldn’t test and verify that, but it works on a single installation.

    Hi Simon,

    Thanks for implementing that. It works on our dev server, so we can plan a roll out for live 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Solution for multisite plugin activation breaks the plugin’ is closed to new replies.