Yoast\WP\SEO\Repositories
Indexable_Cleanup_Repository::clean_indexables_for_authors_archive_disabled()
Cleans up any user indexables when the author archives have been disabled.
Метод класса: Indexable_Cleanup_Repository{}
Хуков нет.
Возвращает
true|false|int
. The number of deleted rows, false if the query fails.
Использование
$Indexable_Cleanup_Repository = new Indexable_Cleanup_Repository(); $Indexable_Cleanup_Repository->clean_indexables_for_authors_archive_disabled( $limit );
- $limit(int) (обязательный)
- The limit we'll apply to the queries.
Код Indexable_Cleanup_Repository::clean_indexables_for_authors_archive_disabled() Indexable Cleanup Repository::clean indexables for authors archive disabled Yoast 23.4
public function clean_indexables_for_authors_archive_disabled( $limit ) { global $wpdb; if ( ! $this->author_archive->are_disabled() ) { return 0; } $indexable_table = Model::get_table_name( 'Indexable' ); // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: Too hard to fix. $delete_query = $wpdb->prepare( "DELETE FROM $indexable_table WHERE object_type = 'user' LIMIT %d", $limit ); // phpcs:enable // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already. return $wpdb->query( $delete_query ); // phpcs:enable }