Yoast\WP\SEO\Routes
Importing_Route::execute()
Executes the rest request, but only if the respective action is enabled.
Метод класса: Importing_Route{}
Хуков нет.
Возвращает
WP_REST_Response|false
. Response or false on non-existent route.
Использование
$Importing_Route = new Importing_Route(); $Importing_Route->execute( $data );
- $data(разное) (обязательный)
- The request parameters.
Код Importing_Route::execute() Importing Route::execute Yoast 24.9
public function execute( $data ) { $plugin = (string) $data['plugin']; $type = (string) $data['type']; $next_url = $this->get_endpoint( $plugin, $type ); try { $importer = $this->get_importer( $plugin, $type ); if ( $importer === false || ! $importer->is_enabled() ) { return new WP_Error( 'rest_no_route', 'Requested importer not found', [ 'status' => 404, ] ); } $result = $importer->index(); if ( $result === false || \count( $result ) === 0 ) { $next_url = false; } return $this->respond_with( $result, $next_url ); } catch ( Exception $exception ) { if ( $exception instanceof Aioseo_Validation_Exception ) { return new WP_Error( 'wpseo_error_validation', $exception->getMessage(), [ 'stackTrace' => $exception->getTraceAsString() ] ); } return new WP_Error( 'wpseo_error_indexing', $exception->getMessage(), [ 'stackTrace' => $exception->getTraceAsString() ] ); } }