| 1105 | * Remove a section from a settings page. |
| 1106 | * |
| 1107 | * Part of the Settings API. Use this to remove settings sections from an admin page. |
| 1108 | * |
| 1109 | * @since 3.3 |
| 1110 | * |
| 1111 | * @global $wp_settings_sections Storage array of all settings sections added to admin pages |
| 1112 | * @global $wp_settings_fields Storage array of settings fields and info about their pages/sections |
| 1113 | * |
| 1114 | * @param string $id Slug-name to identify the section. |
| 1115 | * @param string $page The slug-name of the settings page on which to remove the section. |
| 1116 | */ |
| 1117 | function remove_settings_section( $id, $page ) { |
| 1118 | global $wp_settings_sections, $wp_settings_fields; |
| 1119 | |
| 1120 | unset( $wp_settings_sections[$page][$id] ); |
| 1121 | |
| 1122 | if ( empty( $wp_settings_sections[$page] ) ) |
| 1123 | unset( $wp_settings_sections[$page] ); |
| 1124 | |
| 1125 | unset( $wp_settings_fields[$page][$id] ); |
| 1126 | |
| 1127 | if ( empty( $wp_settings_fields[$page] ) ) |
| 1128 | unset( $wp_settings_fields[$page] ); |
| 1129 | } |
| 1130 | |
| 1131 | /** |
| 1172 | * Remove a field from a section of a settings page |
| 1173 | * |
| 1174 | * Part of the Settings API. Use this to remove a settings field from a |
| 1175 | * settings section inside a settings page. |
| 1176 | * |
| 1177 | * The $callback argument should be the name of a function that echoes out the |
| 1178 | * html input tags for this setting field. Use get_option() to retrive existing |
| 1179 | * values to show. |
| 1180 | * |
| 1181 | * @since 3.3 |
| 1182 | * |
| 1183 | * @global $wp_settings_fields Storage array of settings fields and info about their pages/sections |
| 1184 | * |
| 1185 | * @param string $id Slug-name to identify the field. |
| 1186 | * @param string $page The slug-name of the settings page on which to remove the section. |
| 1187 | * @param string $section The slug-name of the section of the settings page in which to remove the box. |
| 1188 | */ |
| 1189 | function remove_settings_field( $id, $page, $section = 'default' ) { |
| 1190 | global $wp_settings_fields; |
| 1191 | |
| 1192 | unset( $wp_settings_fields[$page][$section][$id] ); |
| 1193 | |
| 1194 | if ( empty( $wp_settings_fields[$page][$section] ) ) |
| 1195 | unset( $wp_settings_fields[$page][$section] ); |
| 1196 | |
| 1197 | if ( empty( $wp_settings_fields[$page] ) ) |
| 1198 | unset( $wp_settings_fields[$page] ); |
| 1199 | } |
| 1200 | |
| 1201 | /** |