Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

“Link to” attribute not added to shortcode #65

Open
montchr opened this issue Nov 20, 2015 · 4 comments
Open

“Link to” attribute not added to shortcode #65

montchr opened this issue Nov 20, 2015 · 4 comments
Labels

Comments

@montchr
Copy link
Contributor

montchr commented Nov 20, 2015

Tested on a fresh install. Seems the linkto attribute is never added when inserting image into post from media library. If you go back to edit the shortcode in place and hit update, it's only then that the attribute is added.

I've selected link to file:

But this is the output:

[img attachment="15" align="alignnone" size="medium" alt="montchr-electric-factory-20151110-44" /]

@montchr
Copy link
Contributor Author

montchr commented Nov 20, 2015

I'm thinking that this might have something to do with linkto not being in the array of allowed attributes here.

@goldenapples
Copy link
Contributor

I'm thinking that this might have something to do with linkto not being in the array of allowed attributes here.

I suspect you're right there. I did some hackery in the data-migration script here to convert links to the appropriate linkto value when migrating old images to shortcodes, but I don't think we're picking up anything for that value for newly-inserted images from the media library screen.

Care to put together a pull request to fix it?

@montchr
Copy link
Contributor Author

montchr commented Nov 20, 2015

Sure, I'll try to put something together this afternoon.

@vralle
Copy link

vralle commented Nov 20, 2015

fix by js: https://gist.github.com/vralle/b0db1083f1c8e392527e

and small fix in php for 'filter_media_send_to_editor':

$allowed_attrs = array(
        'image-size' => 'size',
        'image_alt' => 'alt', 
        'post_excerpt' => 'caption',
        // 'width' => 'width',  // not reported by default js
        'linkto' => 'linkto', // not reported by default js
        'url' => 'url'
    );

And link to attachment post reported by js as 'linkto'='post'. now image-shortcake has link to attachment post as 'linkto'='attachment'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants