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: http://core.svn.wordpress.org/trunk@23775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2013-03-22 07:28:56 +00:00
parent 026d8847b4
commit 3f5f4fa62e

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 );
}
/**