Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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