Skip to content

Instantly share code, notes, and snippets.

@vickybiswas
Created July 13, 2012 03:34
Show Gist options
  • Save vickybiswas/3102546 to your computer and use it in GitHub Desktop.
Save vickybiswas/3102546 to your computer and use it in GitHub Desktop.
Convert Caption in Attachments to a RTE
function vicky($form_fields) {
preg_match('/name="([^"]*)/', $form_fields["post_excerpt"]["html"], $matches);
$args = array("textarea_name" => $matches[1], "media_buttons" => false, 'quicktags' => true, 'textarea_rows' => '5');
preg_match('/>(.*)</', $form_fields["post_excerpt"]["html"], $matches);
ob_start();
wp_editor( html_entity_decode($matches[1]), "wpet_options[textarea_one]", $args );
$html = ob_get_clean();
$form_fields["post_excerpt"]["input"] = "html";
$form_fields["post_excerpt"]["html"] = $html;
return $form_fields;
}
add_filter("attachment_fields_to_edit", "vicky");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment