jQuery('body').on('click','.thumbnail',function () {
            if(wp.media.view.Settings.AttachmentDisplay){
                var _AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay;
                wp.media.view.Settings.AttachmentDisplay = _AttachmentDisplay.extend({
                    render: function() {
                        _AttachmentDisplay.prototype.render.apply(this, arguments);
                        this.$el.find('select.link-to').val('none');
                        this.model.set('link', 'none');
                        this.updateLinkTo();
                    }
                });
            }
            if(wp.media.view.Settings.Gallery){
                var GalleryDisplay=wp.media.view.Settings.Gallery;
                wp.media.view.Settings.Gallery = GalleryDisplay.extend({
                    className: "collection-settings gallery-settings",
                    template: wp.media.template("gallery-settings"),
                    render: function() {
                        GalleryDisplay.prototype.render.apply( this, arguments );
                        this.$el.find('select.link-to').val('none');
                        this.model.set('link', 'none');
                    }
                });
            }
        });

this code i am using to make Default Attachment Display Settings to none, and for the first time when i click on any image . it is not updating to none.

Read more here: first time click on any image…my code doesn’t seem to update


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: