I've searched around but I can't quite pin down the answer for this. I am attempting to use the content of a custom field as post_data and save it to the database as such when a post is created or updated. I need to do this in order to make a frontend posting solution work out using the plugin Advanced Custom Fields.
I think I need something like this:
function tsv_content_save_pre( $post_id ){
global $post;
$tsvpost = get_post($post_id);
$tsvifempty = $tsvpost->post_content; //The "real" post_content
$tsvcontent = get_field('article_content'); //The custom content
if ($tsvifempty == NULL) { //Check if the "real" post content has anything in it first.
$tsvargs = array('post_content' => $tsvcontent);
wp_update_post ($tsvargs);
}
}
add_filter('content_save_pre' , 'tsv_content_save_pre' );
But I'm stuck there. I'm not a plugin developer so filters and such are hard for me to navigate. Can anyone help get me pointed in the right direction?
Thanks in advance.