0

I use wp_update_post() in a Frontend Page. The first part of the function works as expected. post_content and/or post_title will be changed in wp_posts. But the function does not create a revision copy from the old table item as described in the WP Function Reference.

Here is my code

$upd_post = array();
$upd_post['ID'] = $post->ID;
$upd_post['post_title'] = $wp_query->query_vars['4tn_title'];
$upd_post['post_content'] = $wp_query->query_vars['4tn_content'];
$update_result = wp_update_post( $upd_post );

Perhaps it doesn't work because the post_type is a cutom-type 'portfolio' instead 'post'.

If this is the reason what is to do for getting a 'revisioncopy' for portfolio-items

1

The supports parameter for the post type has to ask for revisions.

Example:

register_post_type( 
    'portfolio', 
    array( 
        'supports' => array ( 'revisions' ) 
    ) 
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.