WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
класс не описан

Yoast\WP\SEO\Repositories

Primary_Term_Repository{} Yoast 1.0

Class Primary_Term_Repository.

Хуков нет.

Возвращает

Null. Ничего.

Использование

$Primary_Term_Repository = new Primary_Term_Repository();
// use class methods

Методы

  1. find_by_post_id_and_taxonomy( $post_id, $taxonomy, $auto_create = true )
  2. query()

Код Primary_Term_Repository{} Yoast 15.1.1

<?php
class Primary_Term_Repository {

	/**
	 * Starts a query for this repository.
	 *
	 * @return ORM
	 */
	public function query() {
		return Model::of_type( 'Primary_Term' );
	}

	/**
	 * Retrieves a primary term by a post ID and taxonomy.
	 *
	 * @param int    $post_id     The post the indexable is based upon.
	 * @param string $taxonomy    The taxonomy the indexable belongs to.
	 * @param bool   $auto_create Optional. Creates an indexable if it does not exist yet.
	 *
	 * @return Primary_Term|null Instance of a primary term.
	 */
	public function find_by_post_id_and_taxonomy( $post_id, $taxonomy, $auto_create = true ) {
		/** @var Primary_Term $primary_term */
		$primary_term = $this->query()
			->where( 'post_id', $post_id )
			->where( 'taxonomy', $taxonomy )
			->find_one();

		if ( $auto_create && ! $primary_term ) {
			$primary_term = $this->query()->create();
		}

		return $primary_term;
	}
}