. Enter your Site ID here; schema generation and management happen in the Instant Schema dashboard. * Version: 0.1.0 * Requires at least: 6.4 * Requires PHP: 7.4 * Author: Instant Schema * Author URI: https://instantschema.app * License: GPL-2.0-or-later * License URI: https://www.gnu.org/licenses/gpl-2.0.html * Text Domain: instant-schema * * @package InstantSchema */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } define( 'INSTANT_SCHEMA_VERSION', '0.1.0' ); define( 'INSTANT_SCHEMA_OPTION_SITE_ID', 'instant_schema_site_id' ); define( 'INSTANT_SCHEMA_OPTION_CONNECTION', 'instant_schema_connection' ); define( 'INSTANT_SCHEMA_LOADER_URL', 'https://app.instantschema.app/v1/loader.js' ); define( 'INSTANT_SCHEMA_DASHBOARD_URL', 'https://app.instantschema.app' ); define( 'INSTANT_SCHEMA_API_BASE', 'https://api.instantschema.app' ); /** * The site's own domain — what the connect flow and the report link key on. * * @return string */ function instant_schema_site_domain() { $host = wp_parse_url( home_url(), PHP_URL_HOST ); return is_string( $host ) ? $host : ''; } /** * Read the configured Site ID. * * @return string */ function instant_schema_get_site_id() { return get_option( INSTANT_SCHEMA_OPTION_SITE_ID, '' ); } /** * Enqueue the loader script in , only once a Site ID is set. * * Enqueued rather than echoed, as wp.org requires. The version is null so * WordPress appends no ?ver= — the loader URL is frozen across every * integration and must never drift from docs/shared-spec.md in the * integrations repo. The data-project-id attribute is added by * instant_schema_loader_tag(); together with the /v1/loader.js URL it is * exactly what the dashboard's crawl detection and the loader itself read. */ function instant_schema_enqueue_loader_script() { if ( '' === instant_schema_get_site_id() ) { return; } wp_enqueue_script( 'instant-schema-loader', INSTANT_SCHEMA_LOADER_URL, array(), null, // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion -- the loader URL is frozen and versioned in its path. array( 'strategy' => 'async', 'in_footer' => false, ) ); } add_action( 'wp_enqueue_scripts', 'instant_schema_enqueue_loader_script' ); /** * Add the Site ID to the loader's