Support

Account

Home Forums Backend Issues (wp-admin) Filter a specific text field

Helping

Filter a specific text field

  • Okay, on the back end in a meta box I have a Text field called “folder_location”.

    Under “Default Value” I want to put in a shortcode “[ default_folder_location ]” and when a new post is created, I want the shortcode’s value to be the default, not the name of the shortcode itself.

    How can I filter that specific field for that specific post-type?

    Do I use the “format_value” or “load_value” filter?

    I’m not seeing anything that allows me to get the “default value” for a field.

  • Hi @dnavarrojr ,

    I beleive you can add the custom default value by using the laod field hook

    $address = "my-custom-default";
    	
    add_filter('acf/load_field/name=contact_info',
         function($field) use ($address) {           
    	     $field['default_value'] = $address;
    	     return $field;
         }
    );
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Filter a specific text field’ is closed to new replies.