Yoast\WP\SEO\Abilities\Infrastructure
Term_SEO_Meta_Writer::write_columns
Writes the given columns of a term indexable to the term meta.
Метод класса: Term_SEO_Meta_Writer{}
Хуков нет.
Возвращает
bool. Whether the term meta could be written.
Использование
$Term_SEO_Meta_Writer = new Term_SEO_Meta_Writer(); $Term_SEO_Meta_Writer->write_columns( $indexable, $columns ): bool;
- $indexable(Indexable) (обязательный)
- The term indexable holding the desired state.
- $columns(array
) (обязательный) - The indexable columns to write.
Код Term_SEO_Meta_Writer::write_columns() Term SEO Meta Writer::write columns Yoast 28.9
public function write_columns( Indexable $indexable, array $columns ): bool {
$term_id = (int) $indexable->object_id;
$taxonomy = (string) $indexable->object_sub_type;
$meta = $this->get_stored_meta( $term_id, $taxonomy );
if ( ! \is_array( $meta ) ) {
return false;
}
foreach ( $columns as $column ) {
if ( isset( self::COLUMN_META_KEYS[ $column ] ) ) {
$meta[ self::COLUMN_META_KEYS[ $column ] ] = $this->to_meta_value( $column, $indexable->{$column} );
}
}
$this->save_meta( $term_id, $taxonomy, $meta );
return true;
}