|
238 | 238 | $tag_base = preg_replace( '|^/?blog|', '', $tag_base ); |
239 | 239 | } |
240 | 240 |
|
241 | | -$default_structures = array( |
242 | | - 0 => '', |
243 | | - 1 => $index_php_prefix . '/%year%/%monthnum%/%day%/%postname%/', |
244 | | - 2 => $index_php_prefix . '/%year%/%monthnum%/%postname%/', |
245 | | - 3 => $index_php_prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', |
246 | | - 4 => $index_php_prefix . '/%postname%/', |
247 | | -); |
248 | | - |
249 | 241 | $url_base = home_url( $blog_prefix . $index_php_prefix ); |
250 | 242 |
|
251 | | -$default_structure_inputs = array( |
252 | | - 0 => array( |
| 243 | +$default_structures = array( |
| 244 | + array( |
253 | 245 | 'id' => 'plain', |
254 | 246 | 'label' => __( 'Plain' ), |
| 247 | + 'value' => '', |
255 | 248 | 'example' => home_url( '/?p=123' ), |
256 | | - 'value' => $default_structures[0], |
257 | 249 | ), |
258 | | - 1 => array( |
| 250 | + array( |
259 | 251 | 'id' => 'day-name', |
260 | 252 | 'label' => __( 'Day and name' ), |
| 253 | + 'value' => $index_php_prefix . '/%year%/%monthnum%/%day%/%postname%/', |
261 | 254 | 'example' => $url_base . '/' . gmdate( 'Y/m/d' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', |
262 | | - 'value' => $default_structures[1], |
263 | 255 | ), |
264 | | - 2 => array( |
| 256 | + array( |
265 | 257 | 'id' => 'month-name', |
266 | 258 | 'label' => __( 'Month and name' ), |
| 259 | + 'value' => $index_php_prefix . '/%year%/%monthnum%/%postname%/', |
267 | 260 | 'example' => $url_base . '/' . gmdate( 'Y/m' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', |
268 | | - 'value' => $default_structures[2], |
269 | 261 | ), |
270 | | - 3 => array( |
271 | | - 'id' => 'day-numeric', |
| 262 | + array( |
| 263 | + 'id' => 'numeric', |
272 | 264 | 'label' => __( 'Numeric' ), |
| 265 | + 'value' => $index_php_prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', |
273 | 266 | 'example' => $url_base . '/' . _x( 'archives', 'sample permalink base' ) . '/123', |
274 | | - 'value' => $default_structures[3], |
275 | 267 | ), |
276 | | - 4 => array( |
| 268 | + array( |
277 | 269 | 'id' => 'post-name', |
278 | 270 | 'label' => __( 'Post name' ), |
| 271 | + 'value' => $index_php_prefix . '/%postname%/', |
279 | 272 | 'example' => $url_base . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', |
280 | | - 'value' => $default_structures[4], |
281 | 273 | ), |
282 | 274 | ); |
283 | 275 |
|
| 276 | +$default_structure_values = wp_list_pluck( $default_structures, 'value' ); |
| 277 | + |
284 | 278 | $available_tags = array( |
285 | 279 | /* translators: %s: Permalink structure tag. */ |
286 | 280 | 'year' => __( '%s (The year of the post, four digits, for example 2004.)' ), |
|
336 | 330 | <td> |
337 | 331 | <fieldset class="structure-selection"> |
338 | 332 | <legend class="screen-reader-text"><?php _e( 'Permalink structure' ); ?></legend> |
339 | | - <?php foreach ( $default_structure_inputs as $input ) : ?> |
| 333 | + <?php foreach ( $default_structures as $input ) : ?> |
340 | 334 | <div class="row"> |
341 | 335 | <input id="permalink-input-<?php echo $input['id']; ?>" |
342 | 336 | name="selection" aria-describedby="permalink-<?php echo $input['id']; ?>" |
|
355 | 349 | <div class="row"> |
356 | 350 | <input id="custom_selection" |
357 | 351 | name="selection" type="radio" value="custom" |
358 | | - <?php checked( ! in_array( $permalink_structure, $default_structures, true ) ); ?> |
| 352 | + <?php checked( ! in_array( $permalink_structure, $default_structure_values, true ) ); ?> |
359 | 353 | /> |
360 | 354 | <div> |
361 | 355 | <label for="custom_selection"><?php _e( 'Custom Structure' ); ?></label> |
|
0 commit comments