AnsPress_Query::add_prefetch_id( string $type, integer $id, false|integer $key = false )

Description #

Add pre fetch ids.

Parameters #

  • $type
    string (Required) ids type.
  • $id
    integer (Required) id.
  • $key
    false | integer (Optional) Object key. Default value: false

Source #

File: includes/class-query.php

	public function add_prefetch_id( $type, $id, $key = false ) {
		if ( empty( $id ) ) {
			return;
		}

		if ( ! isset( $this->ids[ $type ] ) ) {
			$this->ids[ $type ] = array();
		}

		if ( ! in_array( $id, $this->ids[ $type ], true ) ) {
			$this->ids[ $type ][] = (int) $id;
		}

		if ( false !== $key ) {
			$this->add_pos( $type, $id, $key );
		}
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment