1293 | | $wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args); |
| 1294 | $built_in_pages_and_sections = array( |
| 1295 | 'discussion' => array( 'default', 'avatars' ), |
| 1296 | 'general' => array( 'default' ), |
| 1297 | 'media' => array( 'default', 'embeds', 'uploads' ), |
| 1298 | 'permalink' => array( 'optional' ), |
| 1299 | 'reading' => array( 'default' ), |
| 1300 | 'writing' => array( 'default', 'remote_publishing', 'post_via_email' ), |
| 1301 | ); |
| 1302 | |
| 1303 | // check the built-in pages and sections |
| 1304 | $section_check = ! empty( $built_in_pages_and_sections[ $page ] ) && in_array( $section, $built_in_pages_and_sections[ $page ] ); |
| 1305 | |
| 1306 | if ( ! $section_check ) { |
| 1307 | // check any sections added by add_settings_section |
| 1308 | $section_check = ! empty( $wp_settings_sections[ $page ][ $section ] ); |
| 1309 | } |
| 1310 | |
| 1311 | $wp_settings_fields[ $page ][ $section ][ $id ] = array( 'id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args ); |
| 1312 | |
| 1313 | return ! $section_check ? new WP_Error( 'invalid_settings_section', sprintf( __('Settings page \'%s\', section \'%s\' does not exist.'), $page, $section ) ) : $section_check; |