WPSEO_Upgrade::remove_indexable_rows_for_disabled_authors_archive()
Removes all user indexable rows when the author archive is disabled.
Метод класса: WPSEO_Upgrade{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->remove_indexable_rows_for_disabled_authors_archive();
Код WPSEO_Upgrade::remove_indexable_rows_for_disabled_authors_archive() WPSEO Upgrade::remove indexable rows for disabled authors archive Yoast 25.0
protected function remove_indexable_rows_for_disabled_authors_archive() { global $wpdb; if ( ! YoastSEO()->helpers->author_archive->are_disabled() ) { return; } // If migrations haven't been completed successfully the following may give false errors. So suppress them. $show_errors = $wpdb->show_errors; $wpdb->show_errors = false; // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. $wpdb->query( $wpdb->prepare( "DELETE FROM %i WHERE %i = 'user'", [ Model::get_table_name( 'Indexable' ), 'object_type' ] ) ); $wpdb->show_errors = $show_errors; }