Created
April 16, 2015 19:07
-
-
Save mcaskill/d43a0421ca7bf5fa8a41 to your computer and use it in GitHub Desktop.
WordPress \ ACF : Add "Nowhere" as a location to "Page Type" rules.
This file contains hidden or 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 | |
/** | |
* 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