WordPress.org

Make WordPress Core

Changeset 34259


Ignore:
Timestamp:
09/17/2015 05:45:31 AM (5 years ago)
Author:
wonderboymusic
Message:

Media: In get_image_send_to_editor(), allow a custom value for $rel.

Props tychay.
Fixes #32074.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r34171 r34259  
    107107 * @since 2.5.0
    108108 *
    109  * @param integer $id image attachment id
    110  * @param string $caption image caption
    111  * @param string $alt image alt attribute
    112  * @param string $title image title attribute
    113  * @param string $align image css alignment property
    114  * @param string $url image src url
    115  * @param string|bool $rel image rel attribute
    116  * @param string $size image size (thumbnail, medium, large, full or added  with add_image_size() )
     109 * @param int     $id      image attachment id
     110 * @param string  $caption image caption
     111 * @param string  $title   image title attribute
     112 * @param string  $align   image css alignment property
     113 * @param string  $url     image src url
     114 * @param string  $rel     image rel attribute
     115 * @param string  $size    image size (thumbnail, medium, large, full or added  with add_image_size() )
    117116 * @return string the html to insert into editor
    118117 */
    119 function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') {
     118function get_image_send_to_editor( $id, $caption, $title, $align, $url='', $rel = '', $size='medium', $alt = '' ) {
    120119
    121120    $html = get_image_tag($id, $alt, '', $align, $size);
    122121
    123     $rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : '';
     122    if ( ! $rel ) {
     123        $rel = ' rel="attachment wp-att-' . esc_attr( $id ) . '"';
     124    } else {
     125        $rel = ' rel="' . esc_attr( $rel ) . '"';
     126    }
    124127
    125128    if ( $url )
Note: See TracChangeset for help on using the changeset viewer.