Yoast\WP\SEO\Commands
Cleanup_Command::cleanup()
Performs a cleanup of custom Yoast tables.
This removes unused, unwanted or orphaned database records, which ensures the best performance. Including:
- Indexables
- Indexable hierarchy
- SEO links
OPTIONS
- [--batch-size=<batch-size>]
- The number of database records to clean up in a single sql query.
--- default: 1000
--- - [--interval=<interval>]
- The number of microseconds (millionths of a second) to wait between cleanup batches.
--- default: 500000
--- - [--network]
- Performs the cleanup on all sites within the network.
EXAMPLES
wp yoast cleanup
Метод класса: Cleanup_Command{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$Cleanup_Command = new Cleanup_Command(); $Cleanup_Command->cleanup( $args, $assoc_args );
- $args(массив|null)
- The arguments.
По умолчанию: null - $assoc_args(массив|null)
- The associative arguments.
По умолчанию: null
Код Cleanup_Command::cleanup() Cleanup Command::cleanup Yoast 22.4
public function cleanup( $args = null, $assoc_args = null ) { if ( isset( $assoc_args['interval'] ) && (int) $assoc_args['interval'] < 0 ) { WP_CLI::error( \__( 'The value for \'interval\' must be a positive integer.', 'wordpress-seo' ) ); } if ( isset( $assoc_args['batch-size'] ) && (int) $assoc_args['batch-size'] < 1 ) { WP_CLI::error( \__( 'The value for \'batch-size\' must be a positive integer higher than equal to 1.', 'wordpress-seo' ) ); } if ( isset( $assoc_args['network'] ) && \is_multisite() ) { $total_removed = $this->cleanup_network( $assoc_args ); } else { $total_removed = $this->cleanup_current_site( $assoc_args ); } WP_CLI::success( \sprintf( /* translators: %1$d is the number of records that are removed. */ \_n( 'Cleaned up %1$d record.', 'Cleaned up %1$d records.', $total_removed, 'wordpress-seo' ), $total_removed ) ); }