Цель: получить кнопку, которая генерит shorttag для вставки линка в текст поста:

funcitons.php:
if (is_admin()){ add_action('admin_init', 'wl_admin_init' ); function wl_admin_init(){ add_filter('attachment_fields_to_edit', "wl_attachment_fields_to_edit", null, 2); add_filter('media_send_to_editor', 'wl_media_send_to_editor', null, 3); } function wl_attachment_fields_to_edit($form_fields, $post) { $n=strpos($post->post_mime_type,'video/'); if ($n!==FALSE){ $type=strtolower(substr($post->post_mime_type,$n)); if ($type=='quicktime') $type='mp4'; if ($type=='video/quicktime') $type='mp4'; $url=wp_get_attachment_url($post->ID); $poster=get_option('videojs_poster'); $width=get_option('videojs_width'); $height=get_option('videojs_height'); $autoplay=get_option('videojs_autoplay'); $preload=get_option('videojs_preload'); $form_fields['url']['html'].="<button type='button' class='button urlpost' title='" . "[video $type=\"$url\" width=$width height=$height poster=\"$poster\" preload=$preload autoplay=$autoplay]" ."'>" . __('Video JS') . "</button>"; } return $form_fields; } #a bit hacky but pretty robust function wl_media_send_to_editor($html, $send_id, $attachment){ if ('['==substr($attachment['url'],0,1)){ return $attachment['url']; } return $html; } }


