Yoast\WP\SEO\Integrations\Watchers
Indexable_Category_Permalink_Watcher::check_option() public Yoast 1.0
Checks if the stripcategorybase key in wpseo_titles has a change in value, and if so, clears the permalink for category indexables.
{} Это метод класса: Indexable_Category_Permalink_Watcher{}
Хуков нет.
Возвращает
null.
Использование
$Indexable_Category_Permalink_Watcher = new Indexable_Category_Permalink_Watcher(); $Indexable_Category_Permalink_Watcher->check_option( $old_value, $new_value );
- $old_value(массив) (обязательный)
- The old value of the wpseo_titles option.
- $new_value(массив) (обязательный)
- The new value of the wpseo_titles option.
Код Indexable_Category_Permalink_Watcher::check_option() Indexable Category Permalink Watcher::check option Yoast 15.6.2
public function check_option( $old_value, $new_value ) {
// If this is the first time saving the option, in which case its value would be false.
if ( $old_value === false ) {
$old_value = [];
}
// If either value is not an array, return.
if ( ! \is_array( $old_value ) || ! \is_array( $new_value ) ) {
return;
}
// If both values aren't set, they haven't changed.
if ( ! isset( $old_value['stripcategorybase'] ) && ! isset( $new_value['stripcategorybase'] ) ) {
return;
}
// If a new value has been set for 'stripcategorybase', clear the category permalinks.
if ( $old_value['stripcategorybase'] !== $new_value['stripcategorybase'] ) {
$this->indexable_helper->reset_permalink_indexables( 'term', 'category', Indexing_Reasons::REASON_CATEGORY_BASE_PREFIX );
}
}