BP_Search::sanitize_args( mixed $args = '' )

Sanitize user inputs before performing search.

Description

Parameters

$args

(Optional)

Default value: ''

Return

(array)

Source

File: bp-search/classes/class-bp-search.php

		public function sanitize_args( $args = '' ) {
			$args = wp_parse_args( $args, array() );

			if ( isset( $args['search_term'] ) ) {
				$args['search_term'] = sanitize_text_field( $args['search_term'] );
			}

			if ( isset( $args['search_subset'] ) ) {
				$args['search_subset'] = sanitize_text_field( $args['search_subset'] );
			}

			if ( isset( $args['per_page'] ) ) {
				$args['per_page'] = absint( $args['per_page'] );
			}

			if ( isset( $args['current_page'] ) ) {
				$args['current_page'] = absint( $args['current_page'] );
			}

			return $args;
		}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.