Filter hook 'fs_ftp_connection_types'

in WP Core File wp-admin/includes/file.php at line 2544

View Source

fs_ftp_connection_types

Filter Hook
Description
Filters the connection types to output to the filesystem credentials form.

Hook Information

File Location wp-admin/includes/file.php View on GitHub
Hook Type Filter
Line Number 2544

Hook Parameters

Type Name Description
string[] $types Types of connections.
array $credentials Credentials to connect with.
string $type Chosen filesystem method.
bool|WP_Error $error Whether the current request has failed to connect, or an error object.
string $context Full path to the directory that is tested for being writable.

Usage Examples

Basic Usage
<?php
// Hook into fs_ftp_connection_types
add_filter('fs_ftp_connection_types', 'my_custom_filter', 10, 5);

function my_custom_filter($types, $credentials, $type, $error, $context) {
    // Your custom filtering logic here
    return $types;
}

Source Code Context

wp-admin/includes/file.php:2544 - How this hook is used in WordPress core
<?php
2539  	 * @param string        $type        Chosen filesystem method.
2540  	 * @param bool|WP_Error $error       Whether the current request has failed to connect,
2541  	 *                                   or an error object.
2542  	 * @param string        $context     Full path to the directory that is tested for being writable.
2543  	 */
2544  	$types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );
2545  	?>
2546  <form action="<?php echo esc_url( $form_post ); ?>" method="post">
2547  <div id="request-filesystem-credentials-form" class="request-filesystem-credentials-form">
2548  	<?php
2549  	// Print a H1 heading in the FTP credentials modal dialog, default is a H2.

PHP Documentation

<?php
/**
	 * Filters the connection types to output to the filesystem credentials form.
	 *
	 * @since 2.9.0
	 * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
	 *
	 * @param string[]      $types       Types of connections.
	 * @param array         $credentials Credentials to connect with.
	 * @param string        $type        Chosen filesystem method.
	 * @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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 5
  • File: wp-admin/includes/file.php
Related Hooks

Related hooks will be displayed here in future updates.