wppaste
WordPress

WP_Privacy_Requests_Table::prepare_items()

Since
4.9.6, 5.1.0
Source
wp-admin/includes/class-wp-privacy-requests-table.php:367
Prepares items to output.

Uses · 6

Source

	public function prepare_items() {		$this->items    = array();		$posts_per_page = $this->get_items_per_page( $this->request_type . '_requests_per_page' );		$args           = array(			'post_type'      => $this->post_type,			'post_name__in'  => array( $this->request_type ),			'posts_per_page' => $posts_per_page,			'offset'         => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page : 0,			'post_status'    => 'any',			's'              => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '',		); 		$orderby_mapping = array(			'requester' => 'post_title',			'requested' => 'post_date',		); 		if ( isset( $_REQUEST['orderby'] ) && isset( $orderby_mapping[ $_REQUEST['orderby'] ] ) ) {			$args['orderby'] = $orderby_mapping[ $_REQUEST['orderby'] ];		} 		if ( isset( $_REQUEST['order'] ) && in_array( strtoupper( $_REQUEST['order'] ), array( 'ASC', 'DESC' ), true ) ) {			$args['order'] = strtoupper( $_REQUEST['order'] );		} 		if ( ! empty( $_REQUEST['filter-status'] ) ) {			$filter_status       = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';			$args['post_status'] = $filter_status;		} 		$requests_query = new WP_Query( $args );		$requests       = $requests_query->posts; 		foreach ( $requests as $request ) {			$this->items[] = wp_get_user_request( $request->ID );		} 		$this->items = array_filter( $this->items ); 		$this->set_pagination_args(			array(				'total_items' => $requests_query->found_posts,				'per_page'    => $posts_per_page,			)		);	}

History

Introduced in 4.9.6. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

5.1.0
Added support for column sorting.from the docblock
4.9.6
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-admin/includes/class-wp-privacy-requests-table.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.