WP_HTML_Processor::get_last_error()publicWP 6.4.0

Returns the last error, if any.

Various situations lead to parsing failure but this class will return false in all those cases. To determine why something failed it's possible to request the last error. This can be helpful to know to distinguish whether a given tag couldn't be found or if content in the document caused the processor to give up and abort processing.

Example

$processor = WP_HTML_Processor::create_fragment( '<template><strong><button><em><p><em>' );
false === $processor->next_tag();
WP_HTML_Processor::ERROR_UNSUPPORTED === $processor->get_last_error();

Метод класса: WP_HTML_Processor{}

Хуков нет.

Возвращает

Строку|null. The last error, if one exists, otherwise null.

Использование

$WP_HTML_Processor = new WP_HTML_Processor();
$WP_HTML_Processor->get_last_error();

Заметки

  • Смотрите: self::ERROR_UNSUPPORTED
  • Смотрите: self::ERROR_EXCEEDED_MAX_BOOKMARKS

Список изменений

С версии 6.4.0 Введена.

Код WP_HTML_Processor::get_last_error() WP 6.6.1

public function get_last_error() {
	return $this->last_error;
}