Skip to content

Instantly share code, notes, and snippets.

@jom
Last active September 25, 2019 12:25
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 jom/8e45d0586161515982d1bcc4ef0c78d4 to your computer and use it in GitHub Desktop.
Save jom/8e45d0586161515982d1bcc4ef0c78d4 to your computer and use it in GitHub Desktop.
Override schema location without geotagging
add_filter( 'wpjm_get_job_listing_structured_data', function( $data ) {
if ( ! isset( $data['jobLocation'] ) ) {
$data['jobLocation'] = [];
$data['jobLocation']['@type'] = 'Place';
}
if ( is_string( $data['jobLocation']['address'] ) ) {
$original_address = $data['jobLocation']['address'];
$data['jobLocation']['address'] = [];
$data['jobLocation']['address'] ['@type'] = 'PostalAddress';
// Uncomment the line below if the string entered in the location field should be used for the streetAddress.
// More info on the options you can use here: https://schema.org/PostalAddress
// $data['jobLocation']['address'] ['streetAddress'] = $original_address;
}
$data['jobLocation']['address']['addressRegion'] = 'Valais';
$data['jobLocation']['address']['addressCountry'] = 'Switzerland';
return $data;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment