Jquery 第一次单击任何图像…;我的代码没有';似乎没有更新

Jquery 第一次单击任何图像…;我的代码没有';似乎没有更新,jquery,wordpress,Jquery,Wordpress,我使用这段代码将默认附件显示设置设为“无”,这是我第一次单击任何图像。它没有更新为“无” jQuery('body').on('click','.thumbnail',function () { if(wp.media.view.Settings.AttachmentDisplay){ var _AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay;

我使用这段代码将默认附件显示设置设为“无”,这是我第一次单击任何图像。它没有更新为“无”

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');
                    }
                });
            }
        });
(function($, _){


        var mediaSettings = wp.media.view.Settings;
        var origAttachDisp = mediaSettings.AttachmentDisplay;
        mediaSettings.AttachmentDisplay = origAttachDisp.extend({
                initialize: function () {
                    origAttachDisp.prototype.initialize.apply(this, arguments);
                    this.$el.find('select.link-to').val('none');
                    this.model.set('link', 'none');
                    this.updateLinkTo();
                }
        })

            var origGalleryDisp = mediaSettings.Gallery;
            mediaSettings.Gallery = origGalleryDisp.extend({
                className: "collection-settings gallery-settings",
                template: wp.media.template("gallery-settings"),
                initialize: function() {
                    origGalleryDisp.prototype.initialize.apply(this, arguments);
                    this.$el.find('select.link-to').val('none');
                    this.model.set('link', 'none');
                }
        })
    }(jQuery, _));