From 337c87e7c731e62c4d278fa5b3a997abf74cf809 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 17 Sep 2015 05:45:31 +0000 Subject: [PATCH] Media: In `get_image_send_to_editor()`, allow a custom value for `$rel`. Props tychay. Fixes #32074. git-svn-id: https://develop.svn.wordpress.org/trunk@34259 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/media.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index d6b4f03002..7b803bb132 100644 --- a/src/wp-admin/includes/media.php +++ b/src/wp-admin/includes/media.php @@ -106,21 +106,24 @@ function the_media_upload_tabs() { * * @since 2.5.0 * - * @param integer $id image attachment id - * @param string $caption image caption - * @param string $alt image alt attribute - * @param string $title image title attribute - * @param string $align image css alignment property - * @param string $url image src url - * @param string|bool $rel image rel attribute - * @param string $size image size (thumbnail, medium, large, full or added with add_image_size() ) + * @param int $id image attachment id + * @param string $caption image caption + * @param string $title image title attribute + * @param string $align image css alignment property + * @param string $url image src url + * @param string $rel image rel attribute + * @param string $size image size (thumbnail, medium, large, full or added with add_image_size() ) * @return string the html to insert into editor */ -function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') { +function get_image_send_to_editor( $id, $caption, $title, $align, $url='', $rel = '', $size='medium', $alt = '' ) { $html = get_image_tag($id, $alt, '', $align, $size); - $rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : ''; + if ( ! $rel ) { + $rel = ' rel="attachment wp-att-' . esc_attr( $id ) . '"'; + } else { + $rel = ' rel="' . esc_attr( $rel ) . '"'; + } if ( $url ) $html = '$html";