Yoast\WP\SEO\Repositories
Indexable_Repository::get_recent_cornerstone_for_post_type
Returns the most recently modified cornerstone content of a post type.
Метод класса: Indexable_Repository{}
Хуков нет.
Возвращает
Indexable[]. array of indexables.
Использование
$Indexable_Repository = new Indexable_Repository(); $Indexable_Repository->get_recent_cornerstone_for_post_type( $post_type, ?int $limit );
- $post_type(строка) (обязательный)
- The post type.
- ?int $limit(обязательный)
- .
Код Indexable_Repository::get_recent_cornerstone_for_post_type() Indexable Repository::get recent cornerstone for post type Yoast 28.4
public function get_recent_cornerstone_for_post_type( string $post_type, ?int $limit ) {
$query = $this->query()
->where( 'object_type', 'post' )
->where( 'object_sub_type', $post_type )
->where_raw( '( is_public IS NULL OR is_public = 1 )' )
->where( 'is_cornerstone', 1 )
->order_by_desc( 'object_last_modified' );
if ( $limit !== null ) {
$query->limit( $limit );
}
return $query->find_many();
}