Created
March 23, 2017 14:34
-
-
Save G3ronim0/6f318bb524d3f43bb5f21b57dbacb308 to your computer and use it in GitHub Desktop.
ACF default value
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
function my_acf_default_cat( $field ) { | |
if( isset( $_GET['cat'] ) && ! empty ( $_GET['cat'] ) ) { | |
$field['default_value'] = esc_attr( $_GET['cat'] ); | |
} | |
return $field; | |
} | |
add_filter('acf/load_field/key=field_58a2165345a9e', 'my_acf_default_cat'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment