request_filesystem_credentials хук-фильтрWP 2.5.0

Filters the filesystem credentials.

Returning anything other than an empty string will effectively short-circuit output of the filesystem credentials form, returning that value instead.

A filter should return true if no filesystem credentials are required, false if they are required but have not been provided, or an array of credentials if they are required and have been provided.

Использование

add_filter( 'request_filesystem_credentials', 'wp_kama_request_filesystem_credentials_filter', 10, 7 );

/**
 * Function for `request_filesystem_credentials` filter-hook.
 * 
 * @param mixed         $credentials                  Credentials to return instead.
 * @param string        $form_post                    The URL to post the form to.
 * @param string        $type                         Chosen type of filesystem.
 * @param bool|WP_Error $error                        Whether the current request has failed to connect, or an error object.
 * @param string        $context                      Full path to the directory that is tested for being writable.
 * @param array         $extra_fields                 Extra POST fields.
 * @param bool          $allow_relaxed_file_ownership Whether to allow Group/World writable.
 *
 * @return mixed
 */
function wp_kama_request_filesystem_credentials_filter( $credentials, $form_post, $type, $error, $context, $extra_fields, $allow_relaxed_file_ownership ){

	// filter...
	return $credentials;
}
$credentials(разное)
Credentials to return instead.
По умолчанию: empty string
$form_post(строка)
The URL to post the form to.
$type(строка)
Chosen type of filesystem.
$error(true|false|WP_Error)
Whether the current request has failed to connect, or an error object.
$context(строка)
Full path to the directory that is tested for being writable.
$extra_fields(массив)
Extra POST fields.
$allow_relaxed_file_ownership(true|false)
Whether to allow Group/World writable.

Список изменений

С версии 2.5.0 Введена.
С версии 4.6.0 The $context parameter default changed from false to an empty string.

Где вызывается хук

request_filesystem_credentials()
request_filesystem_credentials
wp-admin/includes/file.php 2396
$req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields, $allow_relaxed_file_ownership );

Где используется хук в WordPress

Использование не найдено.