Yoast\WP\SEO\Repositories
Indexable_Repository::reset_permalink()
Resets the permalinks of the passed object type and subtype.
Метод класса: Indexable_Repository{}
Хуков нет.
Возвращает
int|true|false
. The number of permalinks changed if the query was succesful. False otherwise.
Использование
$Indexable_Repository = new Indexable_Repository(); $Indexable_Repository->reset_permalink( $type, $subtype );
- $type(строка|null)
- The type of the indexable. Can be null.
По умолчанию: null - $subtype(строка|null)
- The subtype. Can be null.
По умолчанию: null
Код Indexable_Repository::reset_permalink() Indexable Repository::reset permalink Yoast 24.0
public function reset_permalink( $type = null, $subtype = 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 ); } return $query->update_many(); }