Opened 10 years ago
Closed 8 years ago
#24849 closed enhancement (maybelater)
filter in get_url_in_content($content) function
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.6 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
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)"
Attachments (3)
Change History (10)
#1
@
10 years ago
- Component changed from Formatting to Media
- Keywords needs-patch added
- Type changed from feature request to enhancement
#7
@
8 years ago
- Milestone Awaiting Review deleted
- Resolution set to maybelater
- Status changed from new to closed
Since get_url_in_content()
is only ever used by themes, themes can check the return value and return what they want. Seems like this is from 3.6RC2 and would have been way more useful if Post Formats actually happened.
Note: See
TracTickets for help on using
tickets.
Related: #24309