Tribe__Repository__Query_Filters::fields( string $field, null|string $id = null, boolean $override = false )

Add custom select fields to the query.


Parameters

$field

(string) (Required) The field to add to the result.

$id

(null|string) (Optional) ORDER ID to prevent duplicating order-by clauses..

Default value: null

$override

(boolean) (Optional) Whether to override the clause if another by the same ID exists.

Default value: false


Top ↑

Source

File: src/Tribe/Repository/Query_Filters.php

	public function fields( $field, $id = null, $override = false ) {
		if ( $id ) {
			if ( $override || ! isset( $this->query_vars['fields'][ $id ] ) ) {
				$this->query_vars['fields'][ $id ] = $field;
			}
		} else {
			$this->query_vars['fields'][] = $field;
		}

		if ( ! has_filter( 'posts_fields', array( $this, 'filter_posts_fields' ) ) ) {
			add_filter( 'posts_fields', array( $this, 'filter_posts_fields' ), 10, 2 );
		}
	}

Top ↑

Changelog

Changelog
Version Description
4.9.5
4.9.14 Introduced.