Skip to content

Instantly share code, notes, and snippets.

@mcaskill
Created April 16, 2015 19:07
Show Gist options
  • Save mcaskill/d43a0421ca7bf5fa8a41 to your computer and use it in GitHub Desktop.
Save mcaskill/d43a0421ca7bf5fa8a41 to your computer and use it in GitHub Desktop.
WordPress \ ACF : Add "Nowhere" as a location to "Page Type" rules.
<?php
/**
* Filter: Add "Nowhere" as a location to "Page Type" rules.
*
* Useful for third-parties seeking to dynamically embed
* the field group in a non-traditional manner.
*
* @used-by Filer: 'acf/location/rule_values/page_type'
* @param array $choices
* @return array $choices
*/
function location_page_type_rule_values( $choices = [] )
{
// Add "Nowhere"
$choices[''] = __('None');
ksort( $choices );
return $choices;
}
add_filter( 'acf/location/rule_values/page_type', 'location_page_type_rule_values' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment