• Anonymous User 14379775

    (@anonymized-14379775)


    It’s my custom plugin. It works without errors on individual sites but when I try to “Network activate” this plugin I get this:

    Fatal error: Uncaught Error: Call to undefined function wp_get_current_user() in ...\wp-includes\capabilities.php on line 539

    What can be the cause?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Bet Hannon

    (@bethannon1)

    There are some special functions that you will need to include to make a plugin function in network activation. Did you do that? (I don’t have a particular link to refer you to – some of what you will need to add depends on what you are trying to do — uploads, etc.)

    If it works in your situation, it’s perfectly fine to simply single site activate a plugin on all the sites…

    Thread Starter Anonymous User 14379775

    (@anonymized-14379775)

    There are some special functions that you will need to include to make a plugin function in network activation. Did you do that?

    Nope. @bethannon1 Any direction where to go for further information?

    Thread Starter Anonymous User 14379775

    (@anonymized-14379775)

    Is it like to use
    add_network_option()
    instead of
    add_option()
    and so on?

    Moderator Bet Hannon

    (@bethannon1)

    I’m no expert in this, but you might look in the developer.wordpress.org documentation, like:
    https://developer.wordpress.org/cli/commands/plugin/activate/

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    @web2033 It would be easier to answer your question if you explained what your custom plugin actually does.

    Network activation is much the same as regular activation, except that it doesn’t go through the various activation calls for the plugin on a specific site. So, if you’re getting an error, then you’re likely doing something unusual in your plugin to cause that error.

    Thread Starter Anonymous User 14379775

    (@anonymized-14379775)

    @otto42 it’s a parser and it:

    – creates a settings sub-page in “Tools”
    – saves parameters to wp_options
    – uses ajax to make an external call to pull some data
    – uses this data to create new pages and imports images to the media library

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Can’t network activate plugin’ is closed to new replies.