Add a filter for get_the_url(). Make sure get_the_url() also checks for the quote post format, as it currently has a URL field. see #23570.

git-svn-id: https://develop.svn.wordpress.org/trunk@23775 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Helen Hou-Sandi 2013-03-22 07:28:56 +00:00
parent 9a431958e4
commit 4fd8f9915d
1 changed files with 4 additions and 4 deletions

View File

@ -398,7 +398,7 @@ function post_formats_compat( $content, $id = 0 ) {
* @since 3.6.0
*
* @param string $content A string which might contain a URL.
* @param boolean $remove Whether the remove the found URL from the passed content.
* @param boolean $remove Whether to remove the found URL from the passed content.
* @return string The found URL.
*/
function get_content_url( &$content, $remove = false ) {
@ -446,14 +446,14 @@ function get_the_url( $id = 0 ) {
if ( empty( $post ) )
return '';
if ( has_post_format( 'link', $post ) ) {
if ( in_array( get_post_format( $post->ID, array( 'link', 'quote' ) ) ) ) {
$meta = get_post_format_meta( $post->ID );
if ( ! empty( $meta['url'] ) )
return esc_url_raw( $meta['url'] );
return apply_filters( 'get_the_url', esc_url_raw( $meta['url'] ), $post );
}
if ( ! empty( $post->post_content ) )
return get_content_url( $post->post_content );
return apply_filters( 'get_the_url', get_content_url( $post->post_content ), $post );
}
/**