filesystem_method

Filters the filesystem method to use.

Description

apply_filters( 'filesystem_method', (string) $method, (array) $args, (string) $context, (bool) $allow_relaxed_file_ownership ); 

Parameters (4)

0. $method (string)
Filesystem method to return.
1. $args (array)
An array of connection details for the method.
2. $context (string)
Full path to the directory that is tested for being writable.
3. $allow_relaxed_file_ownership (bool)
Whether to allow Group/World writable.

Usage

To run the hook, copy the example below.
  1. $method = apply_filters( 'filesystem_method', $method, $args, $context, $allow_relaxed_file_ownership ); 
  2.  
  3. if ( !empty( $method ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the filesystem_method callback 
  2. function filter_filesystem_method( $method, $args, $context, $allow_relaxed_file_ownership ) { 
  3. // make filter magic happen here... 
  4. return $method
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'filesystem_method', 'filter_filesystem_method', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'filesystem_method', 'filter_filesystem_method', 10, 4 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-admin/includes/file.php  
  1. return apply_filters( 'filesystem_method', $method, $args, $context, $allow_relaxed_file_ownership );