Yoast\WP\SEO\Repositories
Indexable_Repository::reset_permalink
Resets the permalinks of the passed object type and subtype.
Метод класса: Indexable_Repository{}
Хуков нет.
Возвращает
int|bool. The number of permalinks changed if the query was succesful. False otherwise.
Использование
$Indexable_Repository = new Indexable_Repository(); $Indexable_Repository->reset_permalink( $type, $subtype, $object_id );
- $type(строка|null)
- The type of the indexable. Can be null.
По умолчанию:null - $subtype(строка|null)
- The subtype. Can be null.
По умолчанию:null - $object_id(int|null)
- The object ID. Can be null.
По умолчанию:null
Код Indexable_Repository::reset_permalink() Indexable Repository::reset permalink Yoast 28.7
public function reset_permalink( $type = null, $subtype = null, $object_id = null ) {
$query = $this->query()->set(
[
'permalink' => null,
'permalink_hash' => null,
'version' => 0,
],
);
if ( $type !== null ) {
$query->where( 'object_type', $type );
}
if ( $type !== null && $subtype !== null ) {
$query->where( 'object_sub_type', $subtype );
}
if ( $object_id !== null ) {
$query->where( 'object_id', $object_id );
}
return $query->update_many();
}