WP_Links_List_Table::prepare_items()publicWP 1.0

Method of the class: WP_Links_List_Table{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Links_List_Table = new WP_Links_List_Table();
$WP_Links_List_Table->prepare_items();

Notes

  • Global. Int. $cat_id
  • Global. String. $s
  • Global. String. $orderby
  • Global. String. $order

WP_Links_List_Table::prepare_items() code WP 6.6

public function prepare_items() {
	global $cat_id, $s, $orderby, $order;

	$cat_id  = ! empty( $_REQUEST['cat_id'] ) ? absint( $_REQUEST['cat_id'] ) : 0;
	$orderby = ! empty( $_REQUEST['orderby'] ) ? sanitize_text_field( $_REQUEST['orderby'] ) : '';
	$order   = ! empty( $_REQUEST['order'] ) ? sanitize_text_field( $_REQUEST['order'] ) : '';
	$s       = ! empty( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '';

	$args = array(
		'hide_invisible' => 0,
		'hide_empty'     => 0,
	);

	if ( 'all' !== $cat_id ) {
		$args['category'] = $cat_id;
	}
	if ( ! empty( $s ) ) {
		$args['search'] = $s;
	}
	if ( ! empty( $orderby ) ) {
		$args['orderby'] = $orderby;
	}
	if ( ! empty( $order ) ) {
		$args['order'] = $order;
	}

	$this->items = get_bookmarks( $args );
}