Yoast\WP\SEO\Commands
Index_Command::index() public Yoast 1.0
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).
EXAMPLES
wp yoast index
{} Это метод класса: Index_Command{}
Хуки из метода
Возвращает
null
. Null. Ничего.
Использование
$Index_Command = new Index_Command(); $Index_Command->index( $args, $assoc_args );
- $args(массив)
- The arguments.
- $assoc_args(массив)
- The associative arguments.
Код Index_Command::index() Index Command::index Yoast 16.1.1
public function index( $args = null, $assoc_args = null ) {
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();
}
}