| 390 | | if ( ! empty( $_REQUEST['orderby'] ) ) { |
| 391 | | if ( is_array( $_REQUEST['orderby'] ) ) { |
| 392 | | foreach ( $_REQUEST['orderby'] as $key => $value ) { |
| 393 | | echo '<input type="hidden" name="orderby[' . esc_attr( $key ) . ']" value="' . esc_attr( $value ) . '" />'; |
| | 390 | $builtin_hidden_fields = array( |
| | 391 | 'orderby', |
| | 392 | 'order', |
| | 393 | 'post_mime_type', |
| | 394 | 'detached', |
| | 395 | ); |
| | 396 | |
| | 397 | /** |
| | 398 | * Filters the list of hidden custom query variables. |
| | 399 | * This filter should be used to add custom query variables that are hidden from the search query. |
| | 400 | * |
| | 401 | * @since unreleased |
| | 402 | * |
| | 403 | * @param string[] $custom_hidden_fields An array of hidden custom query variables. |
| | 404 | * @param string $class_name The class name of the current list table. |
| | 405 | */ |
| | 406 | $custom_hidden_fields = apply_filters( 'search_box_custom_args', [], get_class( $this ) ); |
| | 407 | |
| | 408 | $hidden_fields = array_merge( |
| | 409 | $builtin_hidden_fields, |
| | 410 | array_filter( $custom_hidden_fields, function ( $query_arg ) { |
| | 411 | return is_string( $query_arg ); |
| | 412 | } ) |
| | 413 | ); |
| | 414 | |
| | 415 | foreach ( $hidden_fields as $name ) { |
| | 416 | if ( ! empty( $_REQUEST[ $name ] ) ) { |
| | 417 | if ( is_array( $_REQUEST[ $name ] ) ) { |
| | 418 | foreach ( $_REQUEST[ $name ] as $key => $value ) { |
| | 419 | echo '<input type="hidden" name="' . esc_attr( $name ) . '[' . esc_attr( $key ) . ']" value="' . esc_attr( $value ) . '" />'; |
| | 420 | } |
| | 421 | } else { |
| | 422 | echo '<input type="hidden" name="' . esc_attr( $name ) . '" value="' . esc_attr( $_REQUEST[ $name ] ) . '" />'; |