Skip to content

Instantly share code, notes, and snippets.

@mishterk
Last active December 12, 2020 19:13
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 mishterk/fd4027381794bd82a42e6b4f730e4818 to your computer and use it in GitHub Desktop.
Save mishterk/fd4027381794bd82a42e6b4f730e4818 to your computer and use it in GitHub Desktop.
An example of getting the current domain post ID in WP Landing Kit. Might be of use if you are loading up ACF fields on a domain post or something similar.
<?php
// e.g; 'mydomain.com'
$current_host = $_SERVER['HTTP_HOST'];
// This will return a WPLK_Domain object, if the domain can be found. Otherwise, NULL.
$domain = wplk_get_domain( );
if($domain){
$domain_id = $domain->post_id();
// Use the domain ID here...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment