Display custom field under image in TinyMCE editor

Question

I have a custom media field called “Source” with the key media_author. I would like to display it under the image in the TinyMCE editor, like the caption field is:

The caption under the inserted image.

The caption field is editable, but that’s not necessary for what I want to add. I found this code in /wp-includes/js/tinymce/plugins/wpeditimage/plugin.js. It looks like it’s part of how the caption is displayed.

return '<div class="mceTemp"><dl id="' + id + '" class="wp-caption ' + align + classes + '" style="width: ' + width + 'px">' +
       '<dt class="wp-caption-dt">'+ img +'</dt><dd class="wp-caption-dd">'+ caption +'</dd></dl></div>';
0
, , , , Jerome Paulos 7 months 0 Answers 76 views 0

Leave an answer