Support

Account

Forum Replies Created

  • Who wants same feature, there is solution:

    put this to functions.php

    
    function trim_acf_fields( $post_id )
    {
      // load from post
      if( isset($_POST['fields']) ) {
        foreach($_POST['fields'] as $key => $value) {
          $_POST['fields'][$key] = trim($value);
        }
      }
    }
    // run before ACF saves the $_POST['fields'] data
    add_action('acf/save_post', 'trim_acf_fields', 1);
    
  • Thank you for reply!

    I know that i could trim it on output, it is good only for website.

    I use WordPress with custom fields as App with REST API with WP-API module or JSON-API module for another platforms like mobile or facebook app.

    And there is neccesary to have consistent data for every device.

    Maybe i could use some Filter hooks to trim all fields.

Viewing 2 posts - 1 through 2 (of 2 total)