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

Reply To: [Waiting for user confirmation] Creating child posts and grandchild posts

$
0
0

Hi luoy

Okay I tried to use the CRED action hook cred_save_data to update the post title of the custom post type 'sell-list' to be formed by a combination of the parent post name and the new post ID. My code looks like this;

add_action('cred_save_data_684','linked_title');
function linked_title($post_id) {
    if (isset($_GET['parent_title'])) {
$parent_title = get_the_title($post->post_parent);
$post_title="$parent_title-$postID";
wp_update_post(array('ID'=>$post_id, 'post_title'=>$post_title));
}
}

But when I create the new post from the CRED form then I always get the same title called 'Auto Draft'

Can you tell me what I have done wrong please.

Regards

Robert


Viewing all articles
Browse latest Browse all 20145

Trending Articles