Title: Retrieving Attachment Display Settings Utilizing WordPress Media Javascript
Last modified: May 17, 2017

---

# Retrieving Attachment Display Settings Utilizing WordPress Media Javascript

 *  [charlespunchatz](https://wordpress.org/support/users/charlespunchatz/)
 * (@charlespunchatz)
 * [9 years ago](https://wordpress.org/support/topic/retrieving-attachment-display-settings-utilizing-wordpress-media-javascript/)
 * I’m having some trouble finding answer as WordPress media javascript seems to
   be poorly documented.
 * I am working on a project that needs to replace the default TinyMCE editor with
   CKEditor.
 * I have the following code to open up the media manager:
 *  `frame = new wp.media.view.MediaFrame.Post({
    title: “Media Manager”, library:{…
   type: ‘image’, … }, button: { text: “Insert Images” }, multiple: true, state:‘
   insert’ });`
 * And to insert images, the following:
 *     ```
           frame.on('insert', function (){
       		var html = [];
       		var attachments = frame.state().get('selection');
       		var selected = attachments.models;
   
       		selected.forEach(function (selection){
       			var attachment = selection.toJSON();
   
       			html.push(
       				"<figure class='image'>" +
       				"<img src='" + attachment.url + "' alt='" + attachment.alt + "'/>" +
       				(attachment.caption !== '' ? "<figcaption>" + attachment.caption + "</figcaption>" : "") +
       				"</figure>"
       			);
       		});
   
       		editor.insertHtml(html.toString());
       	});
       ```
   
 * Which works great to insert any number of images into the CKEditor.
 * However, rather than using the full sized image, I would like to use the image
   URL for whatever sized image was selected in the “Size” field under “Attachment
   Display Settings”. I’m sure there is a way to access the data in those “Attachment
   Display Settings” fields, however I cannot seem to find any information about
   this anywhere.
 * Any help would be greatly appreciated.
 * Thanks!
    -  This topic was modified 9 years ago by [charlespunchatz](https://wordpress.org/support/users/charlespunchatz/).

The topic ‘Retrieving Attachment Display Settings Utilizing WordPress Media Javascript’
is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [media](https://wordpress.org/support/topic-tag/media/)
 * [wordpress media](https://wordpress.org/support/topic-tag/wordpress-media/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [charlespunchatz](https://wordpress.org/support/users/charlespunchatz/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/retrieving-attachment-display-settings-utilizing-wordpress-media-javascript/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
