wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
sanitize_title › WordPress Function
Desde1.0.0
Obsoleton/a
› sanitize_title ( $title, $fallback_title = '', $context = 'save' )
Parâmetros: (3) |
|
Retorna: |
|
Definido em: |
|
Codex: |
Sanitizes a string into a slug, which can be used in URLs or HTML attributes.
By default, converts accent characters to ASCII characters and further limits the output to alphanumeric characters, underscore (_) and dash (-) through the {@see 'sanitize_title'} filter. If$title
is empty and $fallback_title
is set, the latter will be used.Funções relacionadas: sanitize_term, sanitize_key, sanitize_url, sanitize_option, sanitize_file_name
Fonte
function sanitize_title( $title, $fallback_title = '', $context = 'save' ) { $raw_title = $title; if ( 'save' === $context ) { $title = remove_accents( $title ); } /** * Filters a sanitized title string. * * @since 1.2.0 * * @param string $title Sanitized title. * @param string $raw_title The title prior to sanitization. * @param string $context The context for which the title is being sanitized. */ $title = apply_filters( 'sanitize_title', $title, $raw_title, $context ); if ( '' === $title || false === $title ) { $title = $fallback_title; } return $title; }