set.
* @param bool $add_hash Whether a hash will be added as a suffix in the @id.
*
* @return array Schema ImageObject array.
*/
public function simple_image_object( $schema_id, $url, $caption = '', $add_hash = false ) {
$data = $this->generate_object();
$id_suffix = ( $add_hash ) ? \md5( $url ) : '';
$data['@id'] = $schema_id . $id_suffix;
$data['url'] = $url;
$data['contentUrl'] = $url;
if ( ! empty( $caption ) ) {
$data['caption'] = $this->html->smart_strip_tags( $caption );
}
return $data;
}
/**
* Retrieves an image's caption if set, or uses the alt tag if that's set.
*
* @param array $data An ImageObject Schema array.
* @param int $attachment_id Attachment ID.
* @param string $caption The caption string, if there is one.
*
* @return array An imageObject with width and height set if available.
*/
private function add_caption( $data, $attachment_id, $caption = '' ) {
if ( $caption !== '' ) {
$data['caption'] = $caption;
return $data;
}
$caption = $this->image->get_caption( $attachment_id );
if ( ! empty( $caption ) ) {
$data['caption'] = $this->html->smart_strip_tags( $caption );
return $data;
}
return $data;
}
/**
* Generates our bare bone ImageObject.
*
* @return array an empty ImageObject
*/
private function generate_object() {
$data = [
'@type' => 'ImageObject',
];
$data = $this->language->add_piece_language( $data );
return $data;
}
/**
* Adds image's width and height.
*
* @param array $data An ImageObject Schema array.
* @param int $attachment_id Attachment ID.
*
* @return array An imageObject with width and height set if available.
*/
private function add_image_size( $data, $attachment_id ) {
$image_meta = $this->image->get_metadata( $attachment_id );
if ( empty( $image_meta['width'] ) || empty( $image_meta['height'] ) ) {
return $data;
}
$data['width'] = $image_meta['width'];
$data['height'] = $image_meta['height'];
return $data;
}
}
Fatal error: Uncaught Error: Class "Yoast\WP\SEO\Helpers\Schema\Image_Helper" not found in /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php:3424
Stack trace:
#0 /htdocs/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php(271): Yoast\WP\SEO\Generated\Cached_Container->getImageHelper3Service()
#1 /htdocs/wp-content/plugins/wordpress-seo/src/surfaces/schema-helpers-surface.php(53): YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container->get('Yoast\\WP\\SEO\\He...')
#2 /htdocs/wp-content/plugins/wordpress-seo/src/generators/schema/main-image.php(33): Yoast\WP\SEO\Surfaces\Schema_Helpers_Surface->__get('image')
#3 /htdocs/wp-content/plugins/wordpress-seo/src/generators/schema-generator.php(128): Yoast\WP\SEO\Generators\Schema\Main_Image->generate()
#4 /htdocs/wp-content/plugins/wordpress-seo/src/generators/schema-generator.php(75): Yoast\WP\SEO\Generators\Schema_Generator->generate_graph(Array, Object(Yoast\WP\SEO\Context\Meta_Tags_Context))
#5 /htdocs/wp-content/plugins/wordpress-seo/src/presentations/indexable-presentation.php(720): Yoast\WP\SEO\Generators\Schema_Generator->generate(Object(Yoast\WP\SEO\Context\Meta_Tags_Context))
#6 /htdocs/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php(66): Yoast\WP\SEO\Presentations\Indexable_Presentation->generate_schema()
#7 /htdocs/wp-content/plugins/wordpress-seo/src/presenters/schema-presenter.php(61): Yoast\WP\SEO\Presentations\Abstract_Presentation->__get('schema')
#8 /htdocs/wp-content/plugins/wordpress-seo/src/presenters/schema-presenter.php(45): Yoast\WP\SEO\Presenters\Schema_Presenter->get()
#9 /htdocs/wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php(406): Yoast\WP\SEO\Presenters\Schema_Presenter->present()
#10 /htdocs/wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Integrations\Front_End_Integration->present_head('')
#11 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#12 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#13 /htdocs/wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php(377): do_action('wpseo_head')
#14 /htdocs/wp-includes/class-wp-hook.php(324): Yoast\WP\SEO\Integrations\Front_End_Integration->call_wpseo_head('')
#15 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#16 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#17 /htdocs/wp-includes/general-template.php(3065): do_action('wp_head')
#18 /htdocs/wp-content/themes/oceanwp/header.php(15): wp_head()
#19 /htdocs/wp-includes/template.php(810): require_once('/htdocs/wp-cont...')
#20 /htdocs/wp-includes/template.php(745): load_template('/htdocs/wp-cont...', true, Array)
#21 /htdocs/wp-includes/general-template.php(48): locate_template(Array, true, true, Array)
#22 /htdocs/wp-content/plugins/elementor/modules/page-templates/templates/header-footer.php(9): get_header()
#23 /htdocs/wp-includes/template-loader.php(106): include('/htdocs/wp-cont...')
#24 /htdocs/wp-blog-header.php(19): require_once('/htdocs/wp-incl...')
#25 /htdocs/index.php(17): require('/htdocs/wp-blog...')
#26 {main}
thrown in /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php on line 3424