diff --git a/wp-includes/js/media-editor.js b/wp-includes/js/media-editor.js
index a866e4716a..80494ba17f 100644
--- a/wp-includes/js/media-editor.js
+++ b/wp-includes/js/media-editor.js
@@ -9,7 +9,8 @@
// outputting the proper object format based on the
// attachment's type.
props: function( props, attachment ) {
- var link, linkUrl, size, sizes, fallbacks;
+ var link, linkUrl, size, sizes, fallbacks,
+ defaultProps = wp.media.view.settings.defaultProps;
// Final fallbacks run after all processing has been completed.
fallbacks = function( props ) {
@@ -29,8 +30,8 @@
if ( 'image' === props.type ) {
props = _.defaults( props || {}, {
- align: getUserSetting( 'align', 'none' ),
- size: getUserSetting( 'imgsize', 'medium' ),
+ align: defaultProps.align || getUserSetting( 'align', 'none' ),
+ size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ),
url: '',
classes: []
});
@@ -42,7 +43,7 @@
props.title = props.title || attachment.title;
- link = props.link || getUserSetting( 'urlbutton', 'post' );
+ link = props.link || defaultProps.link || getUserSetting( 'urlbutton', 'file' );
if ( 'file' === link )
linkUrl = attachment.url;
else if ( 'post' === link )
diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js
index 733466c867..1050420044 100644
--- a/wp-includes/js/media-views.js
+++ b/wp-includes/js/media-views.js
@@ -438,11 +438,12 @@
},
resetDisplays: function() {
+ var defaultProps = media.view.settings.defaultProps;
this._displays = [];
this._defaultDisplaySettings = {
- align: getUserSetting( 'align', 'none' ),
- size: getUserSetting( 'imgsize', 'medium' ),
- link: getUserSetting( 'urlbutton', 'post' )
+ align: defaultProps.align || getUserSetting( 'align', 'none' ),
+ size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ),
+ link: defaultProps.link || getUserSetting( 'urlbutton', 'file' )
};
},
diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php
index 909ddfe5ec..7e79efdaf4 100644
--- a/wp-includes/media-template.php
+++ b/wp-includes/media-template.php
@@ -291,12 +291,12 @@ function wp_print_media_templates() {
-
-
+
@@ -347,12 +347,12 @@ function wp_print_media_templates() {
data-user-setting="urlbutton"
<# } #>>
-
-
+
diff --git a/wp-includes/media.php b/wp-includes/media.php
index 2f47358d2d..705b36c351 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -1454,6 +1454,12 @@ function wp_enqueue_media( $args = array() ) {
$tabs = apply_filters( 'media_upload_tabs', $tabs );
unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] );
+ $props = array(
+ 'link' => get_option( 'image_default_link_type' ), // db default is 'file'
+ 'align' => get_option( 'image_default_align' ), // empty default
+ 'size' => get_option( 'image_default_size' ), // empty default
+ );
+
$settings = array(
'tabs' => $tabs,
'tabUrl' => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ),
@@ -1465,6 +1471,7 @@ function wp_enqueue_media( $args = array() ) {
'post' => array(
'id' => 0,
),
+ 'defaultProps' => $props,
);
$post = null;