Skip to content

Instantly share code, notes, and snippets.

@ziodave
Last active October 25, 2018 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ziodave/04fc505f2234ec56c9801502422bdaaa to your computer and use it in GitHub Desktop.
Save ziodave/04fc505f2234ec56c9801502422bdaaa to your computer and use it in GitHub Desktop.
Use $_SERVER['host'] as URL
<?php
add_filter( 'wl_website_jsonld', function( $jsonld ) {
$schema = is_ssl() ? 'https://' : 'http://'; // set_url_scheme() is not defined yet
$url = $schema . $_SERVER['HTTP_HOST'] . '/';
$jsonld['@id'] = "$url#website";
$jsonld['url'] = "$url";
return $jsonld;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment