I am creating an online proposal system using a custom post type called 'proposal'. For the approval form, I am simply using a Gravity Form which then emails me if the client approves the proposal.

To track the Approval Status I also created a custom taxonomy called 'proposal-status'. When the proposal is published it automatically sets the Approval Status to 'Pending'.

What I would like is once the client submits the approval form to automatically update the Approval Status to 'Approved'.

To get the page_id or post_id where the form was submitted I added a hidden field to Gravity Forms with the ID of 7.

Here is the code I have so far but I just can't seem to get it to work. Does anyone have any ideas as to what I am missing or have incorrect? If you would paste the full solution below that would be extremely helpful!

add_action( 'gform_after_submission_7', 'wpp_update_porposal_taxonomies', 10, 2 );
function wpp_update_porposal_taxonomies( $entry, $form ){
  global $post;
  global $wpdb;
  global $wp_query;
  $post_id = rgar( $entry, '7' );
// Check if the post has a particular taxonomy
if(has_term( 'approved', 'proposal-status', $post_id )){
    // Assign a term to our post
    wp_set_object_terms( $post_id, 'approved', 'proposal-status' );

Your Answer

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

Browse other questions tagged or ask your own question.