wppaste
WordPress

apply_filters( 'request_filesystem_credentials', mixed $credentials, string $form_post, string $type, bool|WP_Error $error, string $context, array $extra_fields, bool $allow_relaxed_file_ownership )

Since
2.5.0, 4.6.0
Filters the filesystem credentials.

Description

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.

Compatibility

WordPress
since 4.6.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$credentialsmixed
Credentials to return instead. Default empty string.
$form_poststring
The URL to post the form to.
$typestring
Chosen type of filesystem.
$errorbool|WP_Error
Whether the current request has failed to connect, or an error object.
$contextstring
Full path to the directory that is tested for being writable.
$extra_fieldsarray
Extra POST fields.
$allow_relaxed_file_ownershipbool
Whether to allow Group/World writable.

Where this hook fires · 1

  • wp-admin/includes/file.php:2377request_filesystem_credentials()

Source code

	 *                                                    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.	 */	$req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields, $allow_relaxed_file_ownership ); 	if ( '' !== $req_cred ) {		return $req_cred;	} 	if ( empty( $type ) ) {

Changelog

Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.6.0
The $context parameter default changed from false to an empty string.from the docblock
2.5.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.