🚀 Hostinger Optimized
🖥️ Server: Apache
💻 System: Linux webm015.cluster127.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
👤 User: stakrfrcol (69043)
🐘 PHP: 8.3.31
🚫 Disabled: _dyuweyrj4,_dyuweyrj4r,dl

💻 Terminal

📁 /home/stakrfrcol/agency
$

📄 class-primaryimage.php

📁 Path: ./wp-content/plugins/seo-by-rank-math/includes/modules/schema/snippets/class-primaryimage.php
📊 Size: 985 B
🔒 Perm: 0644
📝 MIME: text/x-php
<?php
/**
 * The Primary Image Class.
 *
 * @since      1.0.43
 * @package    RankMath
 * @subpackage RankMath\Schema
 * @author     Rank Math <support@rankmath.com>
 */

namespace RankMath\Schema;

use RankMath\Helper;

defined( 'ABSPATH' ) || exit;

/**
 * PrimaryImage class.
 */
class PrimaryImage implements Snippet {

	/**
	 * Add primaryImage entity in JSON-LD data.
	 *
	 * @param array  $data   Array of JSON-LD data.
	 * @param JsonLD $jsonld JsonLD Instance.
	 *
	 * @return array
	 */
	public function process( $data, $jsonld ) {
		$image = Helper::get_thumbnail_with_fallback( get_the_ID(), 'full' );
		if ( empty( $image ) ) {
			return $data;
		}

		$data['primaryImage'] = [
			'@type'   => 'ImageObject',
			'@id'     => $image[0],
			'url'     => $image[0],
			'width'   => $image[1],
			'height'  => $image[2],
			'caption' => isset( $image['caption'] ) ? $image['caption'] : '',
		];

		$jsonld->add_prop( 'language', $data['primaryImage'] );

		return $data;
	}
}
← Back📥 Raw✏️ Edit🔒 Chmod
✨ File Manager Magic ✨