Hi @helppawz1,
Please try this snippet and see whether it works:
<?php
add_filter( 'forminator_replace_form_data', 'wpmudev_send_post_data_email', 10, 3 );
function wpmudev_send_post_data_email( $content, $data, $original_content ){
if( $data['form_id'] != 361 ){
return $content;
}
if( strpos( $content, '{post-content}' ) !== false ){
if( isset( $data['postdata-1'] ) ){
if( isset( $data['postdata-1']['post-content'] ) ){
$content = str_replace( '{post-content}', $data['postdata-1']['post-content'], $content );
}
}
}
if( strpos( $content, '{post-image}' ) !== false ){
if( isset( $data['postdata-1'] ) ){
if( isset( $data['postdata-1']['post-image'] ) ){
$content = str_replace( '{post-image}', wp_get_attachment_image( $data['postdata-1']['post-image']['attachment_id'], 'full' ), $content );
}
}
}
return $content;
You’ll have to edit the following line in the above code to your form ID:
if( $data['form_id'] != 361 ){
Suppose the from ID is 123, the above line will change to:
if( $data['form_id'] != 123 ){
The snippet uses {post-content} and {post-image} for content and images. The above snippet can be implemented using mu-plugins.
Please check this link on how to implement the above code as a mu-plugins:
https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins
Kind Regards,
Nithin