[wp-trac] [WordPress Trac] #45779: probable issue in Plugin activation hook
WordPress Trac
noreply at wordpress.org
Thu Dec 27 13:38:13 UTC 2018
#45779: probable issue in Plugin activation hook
--------------------------+-----------------------------
Reporter: tazotodua | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
i.e. if we have a simplest plugin:
{{{
<?php
/*
* Plugin Name: example-1
*/
register_activation_hook(__FILE__, "my" );
function my($network_wide)
{
if($network_wide || is_network_admin())
{
die("Activation from Network");
}
}
}}}
and you try to activate it from Network, you get such empty screen:
[[Image(https://i.imgur.com/Jhib3Pm.png)]]
Probably the reason, as far as I can understand, is that, as the plugin is
activated within the external sandbox call, and if it sees an error, it
returns with activation-failure and then in `iframe`, it tries to load the
activated plugin in order to be able to see the error message. However, as
I doubt, in the first call, the `$newtork_wide || is_network_admin()` is
evaluated to true, causing the `die` to be triggered. however, while WP
tries to show the `iframe`, then there is not seen the error, as i suspect
that `$newtork_wide || is_network_admin()` is evaluated to false.
that makes some problems to plugin developers if they target activation
from Network or Single-Site. Will be good if that will be addressed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45779>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list