WP_oEmbed::_add_provider_early() WordPress Method

The WP_oEmbed::_add_provider_early() method is used to add an oEmbed provider to the list of providers that are checked before the others. This is useful if you want to add a new oEmbed provider that is not yet supported by WordPress.

WP_oEmbed::_add_provider_early( string $format, string $provider, bool $regex = false ) #

Adds an oEmbed provider.


Description

The provider is added just-in-time when wp_oembed_add_provider() is called before the ‘plugins_loaded’ hook.

The just-in-time addition is for the benefit of the ‘oembed_providers’ filter.

Top ↑

See also


Top ↑

Parameters

$format

(string)(Required)Format of URL that this provider can handle. You can use asterisks as wildcards.

$provider

(string)(Required)The URL to the oEmbed provider..

$regex

(bool)(Optional) Whether the $format parameter is in a regex format.

Default value: false


Top ↑

Source

File: wp-includes/class-wp-oembed.php

	public static function _add_provider_early( $format, $provider, $regex = false ) {
		if ( empty( self::$early_providers['add'] ) ) {
			self::$early_providers['add'] = array();
		}

		self::$early_providers['add'][ $format ] = array( $provider, $regex );
	}


Top ↑

Changelog

Changelog
VersionDescription
4.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.