maybe_make_link example

$link_text = trim( wp_unslash( $_POST['link_text'] ) );
    if ( ! $link_text ) {
        $link_text = wp_basename( $src );
    }

    $post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 );

    // Ping WordPress for an embed.     $check_embed = $wp_embed->run_shortcode( '[embed]' . $src . '[/embed]' );

    // Fallback that WordPress creates when no oEmbed was found.     $fallback = $wp_embed->maybe_make_link( $src );

    if ( $check_embed !== $fallback ) {
        // TinyMCE view for [embed] will parse this.         $html = '[embed]' . $src . '[/embed]';
    } elseif ( $link_text ) {
        $html = '<a href="' . esc_url( $src ) . '">' . $link_text . '</a>';
    } else {
        $html = '';
    }

    // Figure out what filter to run:
$cached_post = get_post( $cached_post_id );

            $cache      = $cached_post->post_content;
            $cache_time = strtotime( $cached_post->post_modified_gmt );
        }

        $cached_recently = ( time() - $cache_time ) < $ttl;

        if ( $this->usecache || $cached_recently ) {
            // Failures are cached. Serve one if we're using the cache.             if ( '{{unknown}}' === $cache ) {
                return $this->maybe_make_link( $url );
            }

            if ( ! empty( $cache ) ) {
                /** * Filters the cached oEmbed HTML. * * @since 2.9.0 * * @see WP_Embed::shortcode() * * @param string|false $cache The cached HTML result, stored in post meta. * @param string $url The attempted embed URL. * @param array $attr An array of shortcode attributes. * @param int $post_id Post ID. */
Home | Imprint | This part of the site doesn't use cookies.