clean_url
Filter HookDescription
Filters a string cleaned and escaped for output as a URL.Hook Information
File Location |
wp-includes/formatting.php
View on GitHub
|
Hook Type | Filter |
Line Number | 4575 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$good_protocol_url
|
The cleaned URL to be returned. |
string
|
$original_url
|
The URL prior to cleaning. |
string
|
$_context
|
If 'display', replace ampersands and single quotes only. |
Usage Examples
Basic Usage
<?php
// Hook into clean_url
add_filter('clean_url', 'my_custom_filter', 10, 3);
function my_custom_filter($good_protocol_url, $original_url, $_context) {
// Your custom filtering logic here
return $good_protocol_url;
}
Source Code Context
wp-includes/formatting.php:4575
- How this hook is used in WordPress core
<?php
4570 *
4571 * @param string $good_protocol_url The cleaned URL to be returned.
4572 * @param string $original_url The URL prior to cleaning.
4573 * @param string $_context If 'display', replace ampersands and single quotes only.
4574 */
4575 return apply_filters( 'clean_url', $good_protocol_url, $original_url, $_context );
4576 }
4577
4578 /**
4579 * Sanitizes a URL for database or redirect usage.
4580 *
PHP Documentation
<?php
/**
* Filters a string cleaned and escaped for output as a URL.
*
* @since 2.3.0
*
* @param string $good_protocol_url The cleaned URL to be returned.
* @param string $original_url The URL prior to cleaning.
* @param string $_context If 'display', replace ampersands and single quotes only.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/formatting.php
Related Hooks
Related hooks will be displayed here in future updates.