Yoast\WP\SEO\Surfaces\Values
Meta::get_head
Returns the output as would be presented in the head.
Метод класса: Meta{}
Хуки из метода
Возвращает
Объект. The HTML and JSON presentation of the head metadata.
Использование
$Meta = new Meta(); $Meta->get_head();
Код Meta::get_head() Meta::get head Yoast 27.6
public function get_head() {
$presenters = $this->get_presenters();
/** This filter is documented in src/integrations/front-end-integration.php */
$presentation = \apply_filters( 'wpseo_frontend_presentation', $this->context->presentation, $this->context );
$html_output = '';
$json_head_fields = [];
foreach ( $presenters as $presenter ) {
$presenter->presentation = $presentation;
$presenter->replace_vars = $this->replace_vars;
$presenter->helpers = $this->helpers;
$html_output .= $this->create_html_presentation( $presenter );
$json_field = $this->create_json_field( $presenter );
// Only use the output of presenters that could successfully present their data.
if ( $json_field !== null && ! empty( $json_field->key ) ) {
$json_head_fields[ $json_field->key ] = $json_field->value;
}
}
$html_output = \trim( $html_output );
return (object) [
'html' => $html_output,
'json' => $json_head_fields,
];
}