Function Reference: geodir_clean

Summary

Clean variables.

Description

This function is used to create posttype, posts, taxonomy and terms slug.

Package

GeoDirectory

Parameters

$string
(string) (required) The variable to clean.

Default: None

Return Values

(string)
  • Cleaned variable.

Change Log

Since: 1.0.0

Source File

geodir_clean() is located in geodirectory-functions/general_functions.php [Line: 252]

Source Code

function geodir_clean( $string ) {

	$string = trim( strip_tags( stripslashes( $string ) ) );
	$string = str_replace( " ", "-", $string ); // Replaces all spaces with hyphens.
	$string = preg_replace( '/[^A-Za-z0-9\-\_]/', '', $string ); // Removes special chars.
	$string = preg_replace( '/-+/', '-', $string ); // Replaces multiple hyphens with single one.

	return $string;
}