I am wondering how; in Wordpress and PHP - I could dynamically grab the current Form ID (forms come from Gravity Forms) and it's parent page/post ID. (The gravity forms are nested; with an outer page or post)
I am wanting to do this, because I'm also using a 'last modified plugin' i.e. (WP Last Modified Info) - and I need to use a Gravity Forms 'Wordpress Hook' in order for the 'Last Modified Plugin' functionality to reflect after the web forms (via gravity forms) are Saved.
I have this functionality working with the below code; however, I have many forms, and then sometimes - other users beside me, will create Forms; so I don't want to have to create this piece of code per each form that exists.
Any thoughts? In the below code; where '11' and then '921' is identified. (Via Child theme)
add_action( 'gform_after_save_form', 'lmt_update_modified_info_on_form_update', 10, 2 );
function lmt_update_modified_info_on_form_update( $form, $is_new ) {
if ( $form['id'] == 11 ) {
$newdate = date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) );
$args = array(
'ID' => 921,
'post_modified' => $newdate,
'post_modified_gmt' => get_gmt_from_date( $newdate ),
);
wp_update_post( $args );
}