I needed the post content under one post type to be set to a certain value after the submission of a form. I was advised here to add this code to my theme functions.php.. which I did:
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data){
// if a specific form
if ($form_data['id']==12){
add_filter( 'the_content', 'my_the_content_filter', 20 );
function my_the_content_filter( $content ) {
$content = 'MY CONTENT';
return $content;
}
}
}
But the code is not actually working. I need to know how to make it work, and if i should change something in this code to indicate to which form exactly after its submission the post content will be set.. Thanks in advance