[wp-trac] [WordPress Trac] #24849: filter in get_url_in_content($content) function
WordPress Trac
noreply at wordpress.org
Sun Jul 28 08:52:45 UTC 2013
#24849: filter in get_url_in_content($content) function
-----------------------------+-----------------------------
Reporter: ounziw | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: trunk
Severity: minor | Keywords:
-----------------------------+-----------------------------
In WP 3.6 RC2, get_url_in_content($content) in wp-includes/formatting is
{{{
function get_url_in_content( $content ) {
if ( empty( $content ) )
return '';
if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content,
$matches ) )
return esc_url_raw( $matches[2] );
return false;
}
}}}
I propose to add filter for the return value.
{{{
return apply_filters( 'get_url_in_content', false);
}}}
This filter will be useful in cases like this;
"when no image found, I want to return a default image (site logo or
something)"
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24849>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list