379 | | $map_option = $option; |
380 | | $type = str_replace('edit_', '', $map_option); |
381 | | $type = str_replace('_per_page', '', $type); |
382 | | if ( in_array( $type, get_taxonomies() ) ) |
383 | | $map_option = 'edit_tags_per_page'; |
384 | | elseif ( in_array( $type, get_post_types() ) ) |
385 | | $map_option = 'edit_per_page'; |
386 | | else |
387 | | $option = str_replace('-', '_', $option); |
388 | | |
389 | | switch ( $map_option ) { |
390 | | case 'edit_per_page': |
391 | | case 'users_per_page': |
392 | | case 'edit_comments_per_page': |
393 | | case 'upload_per_page': |
394 | | case 'edit_tags_per_page': |
395 | | case 'plugins_per_page': |
396 | | // Network admin |
397 | | case 'sites_network_per_page': |
398 | | case 'users_network_per_page': |
399 | | case 'site_users_network_per_page': |
400 | | case 'plugins_network_per_page': |
401 | | case 'themes_network_per_page': |
402 | | case 'site_themes_network_per_page': |
403 | | $value = (int) $value; |
404 | | if ( $value < 1 || $value > 999 ) |
405 | | return; |
406 | | break; |
407 | | default: |
408 | | |
409 | | /** |
410 | | * Filter a screen option value before it is set. |
411 | | * |
412 | | * The filter can also be used to modify non-standard [items]_per_page |
413 | | * settings. See the parent function for a full list of standard options. |
414 | | * |
415 | | * Returning false to the filter will skip saving the current option. |
416 | | * |
417 | | * @since 2.8.0 |
418 | | * |
419 | | * @see set_screen_options() |
420 | | * |
421 | | * @param bool|int $value Screen option value. Default false to skip. |
422 | | * @param string $option The option name. |
423 | | * @param int $value The number of rows to use. |
424 | | */ |
425 | | $value = apply_filters( 'set-screen-option', false, $option, $value ); |
426 | | |
427 | | if ( false === $value ) |
428 | | return; |
429 | | break; |
| 385 | $option = str_replace( '-', '_', $option ); |
| 386 | |
| 387 | /** |
| 388 | * Filter a screen option value before it is set. |
| 389 | * |
| 390 | * Returning false to the filter will skip saving the current option. |
| 391 | * |
| 392 | * @since 2.8.0 |
| 393 | * |
| 394 | * @see set_screen_options() |
| 395 | * |
| 396 | * @param bool|int $value Screen option value. Default false to skip. |
| 397 | * @param string $option The option name. |
| 398 | * @param int $value The number of rows to use. |
| 399 | */ |
| 400 | $filtered = apply_filters( 'set-screen-option', false, $option, $value ); |
| 401 | |
| 402 | // Check for null to handle filters that return nothing |
| 403 | if ( null !== $filtered ) { |
| 404 | $value = $filtered; |
| 405 | } |
| 406 | if ( false === $value ) { |
| 407 | return; |
432 | | update_user_meta($user->ID, $option, $value); |
433 | | wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
| 410 | update_user_meta( $user->ID, $option, $value ); |
| 411 | wp_safe_redirect( remove_query_arg( array( 'pagenum', 'apage', 'paged' ), wp_get_referer() ) ); |