WP_Embed::maybe_make_link() WordPress Method

The WP_Embed::maybe_make_link() method is used to check if a given URL should be turned into an embeddable link. If so, the method returns the embeddable link. Otherwise, the URL is returned unmodified.

WP_Embed::maybe_make_link( string $url ) #

Conditionally makes a hyperlink based on an internal class variable.


Parameters

$url

(string)(Required)URL to potentially be linked.


Top ↑

Return

(string|false) Linked URL or the original URL. False if 'return_false_on_fail' is true.


Top ↑

Source

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

	public function maybe_make_link( $url ) {
		if ( $this->return_false_on_fail ) {
			return false;
		}

		$output = ( $this->linkifunknown ) ? '<a href="' . esc_url( $url ) . '">' . esc_html( $url ) . '</a>' : $url;

		/**
		 * Filters the returned, maybe-linked embed URL.
		 *
		 * @since 2.9.0
		 *
		 * @param string $output The linked or original URL.
		 * @param string $url    The original URL.
		 */
		return apply_filters( 'embed_maybe_make_link', $output, $url );
	}

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.