WP_List_Table::set_pagination_args()
Sets all the necessary pagination arguments.
Метод класса: WP_List_Table{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->set_pagination_args( $args );
- $args(массив|строка) (обязательный)
- Array or string of arguments with information about the pagination.
Список изменений
С версии 3.1.0 | Введена. |
Код WP_List_Table::set_pagination_args() WP List Table::set pagination args WP 6.5.2
protected function set_pagination_args( $args ) { $args = wp_parse_args( $args, array( 'total_items' => 0, 'total_pages' => 0, 'per_page' => 0, ) ); if ( ! $args['total_pages'] && $args['per_page'] > 0 ) { $args['total_pages'] = (int) ceil( $args['total_items'] / $args['per_page'] ); } // Redirect if page number is invalid and headers are not already sent. if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) { wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) ); exit; } $this->_pagination_args = $args; }