Avoiding previously declared function name error during activation
-
My plugin uses
if ( ! function_exists(…) )
to avoid naming collisions with another plugin whose functions I want to duplicate only if absent. However, if my plugin is already active when the other plugin is activated, you get the “Cannot redeclare” error. All my code is insideplugins_loaded
, but that happens before the activation action (wp-admin/plugins.php?action=activate).I tried using
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); $action = $wp_list_table->current_action();
(from plugins.php) and also
WP_Plugins_List_Table::current_action();
but those don’t work.Any suggestions, other than disabling my plugin, enabling the other plugin, then reenabling my plugin? (That’s fine for me, but not for the end user.) Thanks.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Avoiding previously declared function name error during activation’ is closed to new replies.