On this page
WP_Embed::maybe_make_link( string $url ): string|false
Conditionally makes a hyperlink based on an internal class variable.
Parameters
$urlstring Required-
URL to potentially be linked.
Return
string|false Linked URL or the original URL. False if 'return_false_on_fail' is true.
Source
File: wp-includes/class-wp-embed.php. View all references
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 );
}
Hooks
- apply_filters( 'embed_maybe_make_link',
string $output ,string $url ) -
Filters the returned, maybe-linked embed URL.
Related
Uses
| Uses | Description |
|---|---|
| esc_url() wp-includes/formatting.php | Checks and cleans a URL. |
| esc_html() wp-includes/formatting.php | Escaping for HTML blocks. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| wp_ajax_send_link_to_editor() wp-admin/includes/ajax-actions.php | Ajax handler for sending a link to the editor. |
| WP_Embed::shortcode() wp-includes/class-wp-embed.php | The do_shortcode() callback function. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_embed/maybe_make_link