Connections::primary()

Summary

Get the channel set as primary


Return

(WP_Term)


Source

File: src/BigCommerce/Taxonomies/Channel/Connections.php

	public function primary() {
		$terms = get_terms( [
			'taxonomy'   => Channel::NAME,
			'meta_query' => [
				[
					'key'   => Channel::STATUS,
					'value' => Channel::STATUS_PRIMARY,
				],
			],
			'hide_empty' => false,
			'number'     => 1,
		] );
		if ( empty( $terms ) ) {
			throw new Channel_Not_Found_Exception( __( 'Primary channel is not set.', 'bigcommerce' ) );
		}

		return reset( $terms );
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.