0

I have a strange problem. I am dynamically populating content into Wordpress' tinyMCE editor. Part of this content is a placeholder image, that the user can then replace. The issue is when I click the 'pencil' icon to edit, I am not given the "Replace" button like I would any other images.

This is what I see: enter image description here

This is what I expect, and works on images imported from the media library: enter image description here

Notice, the replace button is present in the second example. I guess because the image is hard-linked and wordpress has no way of knowing if the image exists in the media library. How can I dynamically import an image so this functionality is present?

1

2 Answers 2

0

Not sure how you dynamically populate content into Wordpress.

To get the Edit Image Button the image must be in the Media. Make sure the image has a class="wp-image-{ID}" where {ID} has to be the right maching id of the image you can find via media content. Or while inserting the image and have a look at the source code then you will find that class with the right {ID}

-1

This has something to do with the HTML of a media object. I copy/pasted code from another image imported from the media gallery and it worked. Use this function to insert the content:

http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.setContent

tinyMCE.activeEditor.setContent('<span>some</span> html');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.