Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Last active December 14, 2018 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfontjr/5b0e5e983ca8b0497f530654729d1ba6 to your computer and use it in GitHub Desktop.
Save vfontjr/5b0e5e983ca8b0497f530654729d1ba6 to your computer and use it in GitHub Desktop.
Formidable Pro: Retrieve Post ID and add to meta data
<?php
add_action('frm_after_create_entry', 'after_entry_created', 30, 2);
function after_entry_created($entry_id, $form_id) {
global $wpdb;
if ( $form_id == 2 ) {
$table_name = $wpdb->prefix . 'frm_items';
$post_id = $wpdb->get_var( "SELECT post_id FROM " . $table_name . " where id = " . $entry_id );
FrmEntryMeta::add_entry_meta( $entry_id, 131, "", $post_id); //change 131 to the ID of the field in which you want to store the entry ID
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment