Ticket #28672: 28672.diff
File 28672.diff, 2.0 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/template.php
1217 1217 * @param string $page The slug-name of the settings page on which to show the section (general, reading, writing, ...). 1218 1218 * @param string $section The slug-name of the section of the settings page in which to show the box (default, ...). 1219 1219 * @param array $args Additional arguments 1220 * @return true|WP_Error Will return WP_Error if the page and section have not been defined, true otherwise. 1220 1221 */ 1221 1222 function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) { 1222 global $wp_settings_fields ;1223 global $wp_settings_fields, $wp_settings_sections; 1223 1224 1224 1225 if ( 'misc' == $page ) { 1225 1226 _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) ); … … 1231 1232 $page = 'reading'; 1232 1233 } 1233 1234 1235 $built_in_pages_and_sections = array( 1236 'discussion' => array( 'default', 'avatars' ), 1237 'general' => array( 'default' ), 1238 'media' => array( 'default', 'embeds', 'uploads' ), 1239 'permalink' => array( 'optional' ), 1240 'reading' => array( 'default' ), 1241 'writing' => array( 'default', 'remote_publishing' ), 1242 ); 1243 1244 // check the built-in pages and sections 1245 $section_check = ! empty( $built_in_pages_and_sections[$page] ) && in_array( $section, $built_in_pages_and_sections[$page] ); 1246 1247 if ( ! $section_check ) { 1248 // check any sections added by add_settings_section 1249 $section_check = ! empty( $wp_settings_sections[$page][$section] ); 1250 } 1251 1234 1252 $wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args); 1253 1254 return ! $section_check ? new WP_Error( 'invalid_settings_section', sprintf( __('Settings page \'%s\', section \'%s\' does not exist.'), $page, $section ) ) : $section_check; 1235 1255 } 1236 1256 1237 1257 /**