WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/validate plugin

This page is marked as incomplete. You can help Codex by expanding it.

Description

Checks if a file exists (using validate_file()) and it is a valid WordPress plugin file (using get_plugins())

Parameters

$plugin
(string) (required) The path of the plugin file relative to WP_PLUGIN_DIR.
Default: None

Return Values

(int|WP_Error) 
Return 0 on success and WP_Error on failure with any of the following messages.
  • Invalid plugin path.
  • Plugin file does not exist.
  • The plugin does not have a valid header.

Example

Change Log

Since: 2.5.0

Source File

validate plugin() is located in wp-admin/includes/plugin.php