Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Created July 17, 2025 20:20
Show Gist options
  • Save vfontjr/63920dd262e9027edafbe5b382888964 to your computer and use it in GitHub Desktop.
Save vfontjr/63920dd262e9027edafbe5b382888964 to your computer and use it in GitHub Desktop.
Response to Mohit Manderna on Formidable Community Forum
<?php
add_action( 'frm_after_create_entry', 'save_post_url_to_hidden_field', 30, 2 );
function save_post_url_to_hidden_field( $entry_id, $form_id ) {
// Replace with your actual form ID
if ( $form_id != 42 ) {
return;
}
// Get the entry object, with meta
$entry = FrmEntry::getOne( $entry_id, true );
// Ensure a post was created
if ( empty( $entry->post_id ) ) {
return;
}
// Get the permalink
$post_url = get_permalink( $entry->post_id );
// Replace with your actual hidden field ID
$hidden_field_id = 123;
// Update the entry with the post URL
FrmEntryMeta::update_entry_meta( $entry_id, $hidden_field_id, null, $post_url );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment