Yoast\WP\SEO\Integrations\Watchers
Indexable_Home_Page_Watcher::check_option() public Yoast 1.0
Checks if the home page indexable needs to be rebuild based on option values.
{} Это метод класса: Indexable_Home_Page_Watcher{}
Хуков нет.
Возвращает
null.
Использование
$Indexable_Home_Page_Watcher = new Indexable_Home_Page_Watcher(); $Indexable_Home_Page_Watcher->check_option( $old_value, $new_value, $option );
- $old_value(массив) (обязательный)
- The old value of the option.
- $new_value(массив) (обязательный)
- The new value of the option.
- $option(строка) (обязательный)
- The name of the option.
Код Indexable_Home_Page_Watcher::check_option() Indexable Home Page Watcher::check option Yoast 15.6.2
public function check_option( $old_value, $new_value, $option ) {
$relevant_keys = [
'wpseo_titles' => [ 'title-home-wpseo', 'breadcrumbs-home', 'metadesc-home-wpseo' ],
'wpseo_social' => [ 'og_frontpage_title', 'og_frontpage_desc', 'og_frontpage_image' ],
];
if ( ! isset( $relevant_keys[ $option ] ) ) {
return;
}
foreach ( $relevant_keys[ $option ] as $key ) {
// If both values aren't set they haven't changed.
if ( ! isset( $old_value[ $key ] ) && ! isset( $new_value[ $key ] ) ) {
continue;
}
// If the value was set but now isn't, is set but wasn't or is not the same it has changed.
if ( ! isset( $old_value[ $key ] ) || ! isset( $new_value[ $key ] ) || $old_value[ $key ] !== $new_value[ $key ] ) {
$this->build_indexable();
return;
}
}
}