wp_filter_object_list

Definition:
function wp_filter_object_list( $list, $args = array() {}

Filters a list of objects, based on a set of key => value arguments.

Parameters

  • array $list: An array of objects to filter
  • array $args: An array of key => value arguments to match against each object
  • string $operator: The logical operation to perform. ‘or’ means only one element from the array needs to match; ‘and’ means all elements must match. The default is ‘and’.
  • bool|string $field: A field from the object to place instead of the entire object

Return values

returns:A list of objects or object fields

Source code

function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {

	if ( ! is_array( $list ) )

		return array();



	$list = wp_list_filter( $list, $args, $operator );



	if ( $field )

		$list = wp_list_pluck( $list, $field );



	return $list;

}

3659

wp_filter_nohtml_kses

Definition:
function wp_filter_nohtml_kses($data) {}

Strips all of the HTML in the content.

Parameters

  • string $data: Content to strip all HTML from

Return values

returns:Filtered content without any HTML

Source code

function wp_filter_nohtml_kses($data) {

	return addslashes ( wp_kses(stripslashes( $data ), array()) );

}

3657

wp_filter_kses

Definition:
function wp_filter_kses($data) {}

Sanitize content with allowed HTML Kses rules.

Parameters

  • string $data: Content to filter, expected to be escaped with slashes

Return values

returns:Filtered content

Source code

function wp_filter_kses($data) {

	global $allowedtags;

	return addslashes( wp_kses(stripslashes( $data ), $allowedtags) );

}

3655

wp_filter_comment

Definition:
function wp_filter_comment($commentdata) {}

Filters and sanitizes comment data.
Sets the comment data ‘filtered’ field to true when finished. This can be checked as to whether the comment should be filtered and to keep from filtering the same comment more than once.

Parameters

  • array $commentdata: Contains information on the comment.

Return values

returns:Parsed comment information.

Defined filters

  • pre_user_id
    apply_filters('pre_user_id', $commentdata['user_ID'])
  • pre_user_id
    apply_filters('pre_user_id', $commentdata['user_id'])
  • pre_comment_user_agent
    apply_filters('pre_comment_user_agent', ( isset( $commentdata['comment_agent'] )
  • pre_comment_author_name
    apply_filters('pre_comment_author_name', $commentdata['comment_author'])
  • pre_comment_content
    apply_filters('pre_comment_content', $commentdata['comment_content'])
  • pre_comment_user_ip
    apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP'])
  • pre_comment_author_url
    apply_filters('pre_comment_author_url', $commentdata['comment_author_url'])
  • pre_comment_author_email
    apply_filters('pre_comment_author_email', $commentdata['comment_author_email'])

Source code

function wp_filter_comment($commentdata) {

	if ( isset($commentdata['user_ID']) )

		$commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']);

	elseif ( isset($commentdata['user_id']) )

		$commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_id']);

	$commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) );

	$commentdata['comment_author']       = apply_filters('pre_comment_author_name', $commentdata['comment_author']);

	$commentdata['comment_content']      = apply_filters('pre_comment_content', $commentdata['comment_content']);

	$commentdata['comment_author_IP']    = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']);

	$commentdata['comment_author_url']   = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']);

	$commentdata['comment_author_email'] = apply_filters('pre_comment_author_email', $commentdata['comment_author_email']);

	$commentdata['filtered'] = true;

	return $commentdata;

}

3653

WP_Filesystem

Definition:
function WP_Filesystem( $args = false, $context = false ) {}

Initialises and connects the WordPress Filesystem Abstraction classes.
This function will include the chosen transport and attempt connecting.

Parameters

  • array $args: (optional) Connection args, These are passed directly to the WP_Filesystem_*() classes.
  • string $context: (optional) Context for get_filesystem_method(), See function declaration for more information.

Return values

returns:false on failure, true on success

Defined filters

  • filesystem_method_file
    apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method)

Source code

function WP_Filesystem( $args = false, $context = false ) {

	global $wp_filesystem;



	require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');



	$method = get_filesystem_method($args, $context);



	if ( ! $method )

		return false;



	if ( ! class_exists("WP_Filesystem_$method") ) {

		$abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);

		if ( ! file_exists($abstraction_file) )

			return;



		require_once($abstraction_file);

	}

	$method = "WP_Filesystem_$method";



	$wp_filesystem = new $method($args);



	//Define the timeouts for the connections. Only available after the construct is called to allow for per-transport overriding of the default.

	if ( ! defined('FS_CONNECT_TIMEOUT') )

		define('FS_CONNECT_TIMEOUT', 30);

	if ( ! defined('FS_TIMEOUT') )

		define('FS_TIMEOUT', 30);



	if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )

		return false;



	if ( !$wp_filesystem->connect() )

		return false; //There was an erorr connecting to the server.



	// Set the permission constants if not already set.

	if ( ! defined('FS_CHMOD_DIR') )

		define('FS_CHMOD_DIR', 0755 );

	if ( ! defined('FS_CHMOD_FILE') )

		define('FS_CHMOD_FILE', 0644 );



	return true;

}

3651