Skip to content

Instantly share code, notes, and snippets.



Last active Apr 12, 2019
What would you like to do?
Only show ACF admin page on local domain
* Determines if string ends with a specific sub string.
* @param string $haystack The string to search in.
* @param string $needle The sub-string to search for.
* @return boolean
function string_ends_with($haystack, $needle) {
$length = strlen($needle);
return $length === 0 || (substr($haystack, -$length) === $needle);
* Only show Custom Fields admin page on ".local" address.
add_filter('acf/settings/show_admin', function () {
return string_ends_with(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment