Title: WP_oEmbed::sanitize_provider
Published: August 20, 2026

---

# WP_oEmbed::sanitize_provider( array-key $match_mask, mixed $data ): array{

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Sanitizes and normalizes a single oEmbed provider entry.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#description)󠁿

Validates that the match mask is a non-empty string and that the provider data is
an array with a non-empty string endpoint URL at index 0. Normalizes the optional
regex flag at index 1 to a boolean.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#parameters)󠁿

 `$match_mask`array-keyrequired

The URL pattern used to match against URLs.

`$data`mixedrequired

The raw provider data to sanitize.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#return)󠁿

 array{ match_mask: non-empty-string, endpoint: non-empty-string, is_regex: bool}
|null Normalized provider array, or null if malformed.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#source)󠁿

    ```php
    private function sanitize_provider( $match_mask, $data ): ?array {
    	if (
    		is_string( $match_mask ) &&
    		'' !== $match_mask &&
    		is_array( $data ) &&
    		isset( $data[0] ) &&
    		is_string( $data[0] ) &&
    		'' !== $data[0]
    	) {
    		return array(
    			'match_mask' => $match_mask,
    			'endpoint'   => $data[0],
    			'is_regex'   => (bool) ( $data[1] ?? false ),
    		);
    	}
    	return null;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-oembed.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-oembed.php#L285)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-oembed.php#L285-L301)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_oEmbed::get_provider()](https://developer.wordpress.org/reference/classes/wp_oembed/get_provider/)`wp-includes/class-wp-oembed.php` |

Takes a URL and returns the corresponding oEmbed provider’s URL, if there is one.

  | 
| [WP_oEmbed::__construct()](https://developer.wordpress.org/reference/classes/wp_oembed/__construct/)`wp-includes/class-wp-oembed.php` |

Constructor.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_oembed/sanitize_provider/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.1.0](https://developer.wordpress.org/reference/since/7.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_oembed%2Fsanitize_provider%2F)
before being able to contribute a note or feedback.