diff --git src/wp-admin/includes/template.php src/wp-admin/includes/template.php
index ad87a89521..f1b024d9f5 100644
|
|
function do_settings_sections( $page ) { |
1697 | 1697 | } |
1698 | 1698 | } |
1699 | 1699 | |
| 1700 | /** |
| 1701 | * Check whether a particular settings section has settings fields. |
| 1702 | * |
| 1703 | * @global array $wp_settings_fields Storage array of settings fields and their pages/sections. |
| 1704 | * |
| 1705 | * @since 5.6.0 |
| 1706 | * |
| 1707 | * @param string $page Slug title of the admin page whose settings fields you want to check. |
| 1708 | * @param string $section Slug title of the settings section whose fields you want to check. |
| 1709 | * @return bool True if the settings section has settings fields. False otherwise. |
| 1710 | */ |
| 1711 | function has_settings_fields( $page, $section ) { |
| 1712 | global $wp_settings_fields; |
| 1713 | |
| 1714 | return isset( $wp_settings_fields[ $page ][ $section ] ) && $wp_settings_fields[ $page ][ $section ]; |
| 1715 | } |
| 1716 | |
1700 | 1717 | /** |
1701 | 1718 | * Print out the settings fields for a particular settings section. |
1702 | 1719 | * |
diff --git src/wp-admin/options-media.php src/wp-admin/options-media.php
index 6236b20f6d..425a8bbea5 100644
|
|
if ( ! current_user_can( 'manage_options' ) ) { |
13 | 13 | wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
14 | 14 | } |
15 | 15 | |
16 | | $title = __( 'Media Settings' ); |
17 | | $parent_file = 'options-general.php'; |
| 16 | $title = __( 'Media Settings' ); |
| 17 | $parent_file = 'options-general.php'; |
| 18 | $can_edit_uploads_dir = false; |
18 | 19 | |
19 | 20 | $media_options_help = '<p>' . __( 'You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.' ) . '</p>'; |
20 | 21 | |
… |
… |
if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : |
107 | 108 | <h2 class="title"><?php _e( 'Uploading Files' ); ?></h2> |
108 | 109 | <table class="form-table" role="presentation"> |
109 | 110 | <?php |
| 111 | $can_edit_uploads_dir = get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) !== 'wp-content/uploads' && get_option( 'upload_path' ) ); |
110 | 112 | /* |
111 | 113 | * If upload_url_path is not the default (empty), |
112 | 114 | * or upload_path is not the default ('wp-content/uploads' or empty), |
113 | 115 | * they can be edited, otherwise they're locked. |
114 | 116 | */ |
115 | | if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'wp-content/uploads' && get_option( 'upload_path' ) ) ) : |
| 117 | if ( $can_edit_uploads_dir ) : |
116 | 118 | ?> |
117 | 119 | <tr> |
118 | 120 | <th scope="row"><label for="upload_path"><?php _e( 'Store uploads in this folder' ); ?></label></th> |
… |
… |
if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : |
132 | 134 | <p class="description"><?php _e( 'Configuring this is optional. By default, it should be blank.' ); ?></p> |
133 | 135 | </td> |
134 | 136 | </tr> |
| 137 | <?php endif; ?> |
| 138 | |
| 139 | <?php if ( $can_edit_uploads_dir || has_settings_fields( 'media', 'uploads' ) ) : ?> |
135 | 140 | <tr> |
136 | 141 | <td colspan="2" class="td-full"> |
137 | 142 | <?php else : ?> |