Skip to content

Instantly share code, notes, and snippets.

Last active April 12, 2019 14:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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