[php]
/**
* Add an HTML5 data attribute to the link
*
* @param string $html
* @param int $id
* @return string
*/
function wedevs_send_to_editor( $html, $id ) {
return str_replace( ‘}
add_filter( ‘image_send_to_editor’, ‘wedevs_send_to_editor’, 10, 2 );
[/php]
[php]
window.send_to_editor = function(html) {
var attachment_id = $(html).data(‘id’);
tb_remove();
};
[/php]
Источник: http://tareq.wedevs.com/2013/02/get-attachment-id-from-insert-into-postpage-button/
comments powered by HyperComments