Forums

Adding a custom Link URL button to Media Library tab (1 post)

  1. Lars M
    Member
    Posted 1 year ago #

    I would like to add a new button the to Link URL options in the Media Library tab. The button should insert a short tag, but strip out the 'a href' when the custom url is inserted into the post.

    This code is from /wp-admin/includes/media.php

    function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') {
    
        $html = get_image_tag($id, $alt, $title, $align, $size);
    
        $rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : '';
    
        **if ( $url )
            $html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";**
    
        $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt );
    
        return $html;
    }

    Can anyone help with hooking into that function, to accomplish what I'm trying to do?

Topic Closed

This topic has been closed to new replies.

About this Topic