Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: delete_plugin

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
830           }
831
832           /**
833            * Fires immediately before a plugin deletion attempt.
834            *
835            * @since 4.4.0
836            *
837            * @param string $plugin_file Plugin file name.
838            */
839           do_action( 'delete_plugin', $plugin_file );
840
841           $this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) );
842
843           // If plugin is in its own directory, recursively delete the directory.
844           if ( strpos( $plugin_file, '/' ) && $this_plugin_dir != $plugins_dir ) { //base check on if plugin includes directory separator AND that it's not the root plugin folder
845                $deleted = $wp_filesystem->delete( $this_plugin_dir, true );
846           } else {
847                $deleted = $wp_filesystem->delete( $plugins_dir . $plugin_file );
848           }