Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Assigned] CRED – How To Set Post Title Automatically Through Custom Fields

$
0
0
Hello Shelby,

this can be achieved, through CRED hooks lke

add_action('cred_save_data', 'build_title', 10, 2);

function build_title($post_id, $formdata)
{
$field1=get_post_meta($post_id, 'field1');
$field2=get_post_meta($post_id, 'field2');

$post_title="$field1 $field2";
wp_update_post(array('ID'=>$post_id, 'post_title'=>$post_title));
}

Note this code is tentative, just as an illustration example

http://codex.wordpress.org/Function_Reference/get_post_meta
http://codex.wordpress.org/Function_Reference/wp_update_post
http://wp-types.com/documentation/user-guides/cred-api/

Hope this helps


Viewing all articles
Browse latest Browse all 20145

Trending Articles