sanitize_title

Definition:
function sanitize_title($title, $fallback_title = '', $context = 'save') {}

Sanitizes title or use fallback title.
Specifically, HTML and PHP tags are stripped. Further actions can be added via the plugin API. If $title is empty and $fallback_title is set, the latter will be used.

Parameters

  • string $title: The string to be sanitized.
  • string $fallback_title: Optional. A title to use if $title is empty.
  • string $context: Optional. The operation for which the string is sanitized

Return values

returns:The sanitized string.

Defined filters

  • sanitize_title
    apply_filters('sanitize_title', $title, $raw_title, $context)

Source code

function sanitize_title($title, $fallback_title = '', $context = 'save') {

	$raw_title = $title;



	if ( 'save' == $context )

		$title = remove_accents($title);



	$title = apply_filters('sanitize_title', $title, $raw_title, $context);



	if ( '' === $title || false === $title )

		$title = $fallback_title;



	return $title;

}

2791

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: