Support

Account

Home Forums ACF PRO acf_form field instructions translations Reply To: acf_form field instructions translations

  • The first print_r() results I posted is after the attempt to translate.
    if I edit the post in the admin and save it and then load that post in the front end it is still not working.
    It start to work only after form submission.
    I discover that the problem is in api-filed.php in function _acf_get_field_by_id (starts around line 916).

    First time the page with the form is loaded

    // get post
    	$post = get_post( $post_id );

    return translated values instead of full string values in this way:

    WP_Post Object
    (
        [ID] => 655
        [post_author] => 1
        [post_date] => 2015-06-17 12:25:15
        [post_date_gmt] => 2015-06-17 10:25:15
        [post_content] => a:12:{s:4:"type";s:4:"text";s:12:"instructions";s:99:"(nome e numero della strada)";s:8:"required";i:1;s:17:"conditional_logic";i:0;s:7:"wrapper";a:3:{s:5:"width";i:50;s:5:"class";s:0:"";s:2:"id";s:0:"";}s:13:"default_value";s:3:"azz";s:11:"placeholder";s:0:"";s:7:"prepend";s:0:"";s:6:"append";s:0:"";s:9:"maxlength";s:0:"";s:8:"readonly";i:0;s:8:"disabled";i:0;}
        [post_title] => indirizzo
        ........
    )

    instead of the correct way which is this one:

    WP_Post Object
    (
        [ID] => 655
        [post_author] => 1
        [post_date] => 2015-06-17 12:25:15
        [post_date_gmt] => 2015-06-17 10:25:15
        [post_content] => a:12:{s:4:"type";s:4:"text";s:12:"instructions";s:99:"[:it](nome e numero della strada)[:en](name and number of street)[:fr](nom et numéro de la rue)[:]";s:8:"required";i:1;s:17:"conditional_logic";i:0;s:7:"wrapper";a:3:{s:5:"width";i:50;s:5:"class";s:0:"";s:2:"id";s:0:"";}s:13:"default_value";s:3:"azz";s:11:"placeholder";s:0:"";s:7:"prepend";s:0:"";s:6:"append";s:0:"";s:9:"maxlength";s:0:"";s:8:"readonly";i:0;s:8:"disabled";i:0;}
        [post_title] => [:it]indirizzo[:en]address[:fr]adresse[:]
        ........
    )

    and which is the way $post object is correctly returned after form submission

    In that way inside the _acf_get_field_by_id function

    // unserialize
    	$data = maybe_unserialize( $post->post_content );

    returns a boolean instead of an array due unserialization which gets error while parsing the uncorrect
    s:99:"(nome e numero della strada)";

    of course: the string length is 28 chars and not 99!