• Resolved kiterfred

    (@kiterfred)


    I got a problem with Forminator and custom fields.
    I want to show custom post data with rich text format in a post.
    For the normal post data everything is fine, but the post custom data is just plain text.

    I have a form, which creates posts. The normal post data from forminator is stored properly with richtext format.
    The post custom data entry has lost it’s format values and i just get the plain text without any richtext formats.

    But under Forminator/Submissions, i can see all entries.

    The custom fields are listet twice.
    Once just with plain text and field type like textarea-1: my text and
    second as field of the Forminator form and properly formatted like TextareaName: <b>text</b>.

    I also use Advanced Custom Fields to show those custom fields in my post.
    I have no clue, how to get the right formatted data. Hopefully someone can help me out.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    HI @kiterfred,

    I assume the custom fields is created using the ACF plugin? If yes, could you please share a screenshot of the custom fields created on the ACF plugin side?

    Also if possible, please share the form export so that we could check if it’s something that could be replicated on our side too.

    Please check the following doc on how to export a form:
    https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export

    If you are concerned about any sensitive information in the form, then you can duplicate your form, remove any sensitive information, and then export it.

    You can share the export file via Google Drive, Dropbox or any cloud services in the next reply.

    Looking forward to your response.

    Kind Regards,
    Nithin

    Thread Starter kiterfred

    (@kiterfred)

    Hey Nithin,

    thank you for your reply.
    I made a minimal example of my problem.
    You can get the formnator form and the acf export from

    https://www.dropbox.com/sh/881hi87nf7nbqht/AADmFqeLFPqOTXG9FInixhv6a?dl=0

    Version of
    ACF is 6.0.5
    Forminator is 1.20.1
    Wordpress is 6.1.1

    If i can do more to help you please write me.

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @kiterfred

    Thank you, I was able to replicate the issue.

    It seems that the content of the “textarea” field gets “sanitized” or “cleaned-up” before it’s passed over to the custom field sub-field of “post-data” and I’m not quite sure if this is intentional or a glitch/bug.

    I have asked our developers for consultation on this and I’m awaiting their response.

    We’ll update you here with more information once we only get more insights into this.

    Kind regards,
    Adam

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @kiterfred

    I got some feedback from our developers on this.

    Please try adding this code snippet to the site:

    <?php 
    
    add_filter( 'forminator_field_postdata_sanitize', 'wpmudev_sanitize_fix_postdata', 10, 3 );
    function wpmudev_sanitize_fix_postdata( $data, $field, $original_data ) {
    	if ( ! empty( $original_data['post-custom'] ) ) {
    		foreach ( $original_data['post-custom'] as $key => $value ) {
    			if ( $value['key'] == 'anforderungen' ) {
    				if ( $value['value'] != '' ) {
    					$data['post-custom'][$key]['value'] = wp_kses_post( $value['value'] );
    				}
    			}
    		}
    	}
    	return $data;
    }

    To do this:

    – create an empty file with a .php extension (e.g. “forminator-custom-fields-nosanitize.php”)
    – copy and paste this code into it and save the file
    – upload the file to the “/wp-content/mu-plugins” folder of your site’s WordPress installation

    Then test the form and it should work.

    Best regards,
    Adam

    Thread Starter kiterfred

    (@kiterfred)

    Thank you so much for your help.

    This solves my problem.

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @kiterfred,

    Glad to know that the workaround provided resolved the issue.

    If you found our plugin useful, please leave us a rating to help us maintain the plugin forever.

    https://www.ads-software.com/support/plugin/forminator/reviews/

    Kind Regards,
    Nebu John

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Forminator Post Custom Data richtext is missing’ is closed to new replies.