Random WordPress Function

Learn about a new WordPress function every day!


Function Signature:

sanitize_trackback_urls

Function Description:

Sanitizes space or carriage return separated URLs that are used to send trackbacks.

Function Examples:

⚠️ Examples below are generated with GPT-3 once every hour. Do not take them too seriously.
Consider them as some extra input in your learning process - reason about them. Will it work? What could fail?
// Example of basic usage:
$trackback_urls = array(
    'http://example.com/trackback',
    'https://example.org/trackback'
);
$sanitized_urls = sanitize_trackback_urls($trackback_urls);
// Result: $sanitized_urls will contain the same URLs as input as they are already well-formed.
// Example showing how to handle invalid URLs:
$trackback_urls = array(
    'http://example.com/trackback',
    'invalid-url',
    'https://example.org/trackback'
);
$sanitized_urls = sanitize_trackback_urls($trackback_urls);
// Result: $sanitized_urls will only contain the valid URLs and remove the invalid one.
// Example demonstrating how to handle duplicate URLs:
$trackback_urls = array(
    'http://example.com/trackback',
    'https://example.org/trackback',
    'http://example.com/trackback'
);
$sanitized_urls = sanitize_trackback_urls($trackback_urls);
// Result: $sanitized_urls will remove the duplicate URL 'http://example.com/trackback' and keep only one instance of it.