Last active
December 12, 2020 19:13
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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