wp_register_plugin_realpath example

do_action( 'pre_uninstall_plugin', $plugin$uninstallable_plugins );

    if ( file_exists( WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php' ) ) {
        if ( isset( $uninstallable_plugins[ $file ] ) ) {
            unset( $uninstallable_plugins[ $file ] );
            update_option( 'uninstall_plugins', $uninstallable_plugins );
        }
        unset( $uninstallable_plugins );

        define( 'WP_UNINSTALL_PLUGIN', $file );

        wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file );
        include_once WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php';

        return true;
    }

    if ( isset( $uninstallable_plugins[ $file ] ) ) {
        $callable = $uninstallable_plugins[ $file ];
        unset( $uninstallable_plugins[ $file ] );
        update_option( 'uninstall_plugins', $uninstallable_plugins );
        unset( $uninstallable_plugins );

        

        iframe_header( __( 'Plugin Reactivation' ), true );
        if ( isset( $_GET['success'] ) ) {
            echo '<p>' . __( 'Plugin reactivated successfully.' ) . '</p>';
        }

        if ( isset( $_GET['failure'] ) ) {
            echo '<p>' . __( 'Plugin failed to reactivate due to a fatal error.' ) . '</p>';

            error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
            ini_set( 'display_errors', true ); // Ensure that fatal errors are displayed.             wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
            include WP_PLUGIN_DIR . '/' . $plugin;
        }
        iframe_footer();
    } elseif ( 'install-plugin' === $action ) {

        if ( ! current_user_can( 'install_plugins' ) ) {
            wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
        }

        require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; // For plugins_api().
        

    do_action( 'mu_plugin_loaded', $mu_plugin );
}
unset( $mu_plugin$_wp_plugin_file );

// Load network activated plugins. if ( is_multisite() ) {
    foreach ( wp_get_active_network_plugins() as $network_plugin ) {
        wp_register_plugin_realpath( $network_plugin );

        $_wp_plugin_file = $network_plugin;
        include_once $network_plugin;
        $network_plugin = $_wp_plugin_file; // Avoid stomping of the $network_plugin variable in a plugin.
        /** * Fires once a single network-activated plugin has loaded. * * @since 5.1.0 * * @param string $network_plugin Full path to the plugin's main file. */
Home | Imprint | This part of the site doesn't use cookies.