Yoast\WP\SEO\Commands
Index_Command::index()
Indexes all your content to ensure the best performance.
OPTIONS
- [--network]
- Performs the indexation on all sites within the network.
- [--reindex]
- Removes all existing indexables and then reindexes them.
- [--skip-confirmation]
- Skips the confirmations (for automated systems).
- [--interval=<interval>]
- The number of microseconds (millionths of a second) to wait between index actions.
--- default: 500000
---
EXAMPLES
wp yoast index
Метод класса: Index_Command{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
$Index_Command = new Index_Command(); $Index_Command->index( $args, $assoc_args );
- $args(массив|null)
- The arguments.
По умолчанию: null - $assoc_args(массив|null)
- The associative arguments.
По умолчанию: null
Код Index_Command::index() Index Command::index Yoast 23.5
public function index( $args = null, $assoc_args = null ) { if ( ! $this->indexable_helper->should_index_indexables() ) { WP_CLI::log( \__( 'Your WordPress environment is running on a non-production site. Indexables can only be created on production environments. Please check your `WP_ENVIRONMENT_TYPE` settings.', 'wordpress-seo' ) ); return; } if ( ! isset( $assoc_args['network'] ) ) { $this->run_indexation_actions( $assoc_args ); return; } $criteria = [ 'fields' => 'ids', 'spam' => 0, 'deleted' => 0, 'archived' => 0, ]; $blog_ids = \get_sites( $criteria ); foreach ( $blog_ids as $blog_id ) { \switch_to_blog( $blog_id ); \do_action( '_yoast_run_migrations' ); $this->run_indexation_actions( $assoc_args ); \restore_current_blog(); } }