Last active
January 25, 2023 13:45
-
-
Save wpt00ls/b969f097a9e5a40d4fc83f35a47b624c to your computer and use it in GitHub Desktop.
Replace the gravityform ID for the divi gravity form module with a programmatically computed form ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A filter used in the "Divi Gravity Form" module to programmatically change the | |
* gravity form ID for the divi module. | |
*/ | |
add_filter( | |
'wpt_divi_gravity_form_id', | |
function ( | |
$gravity_form_id, | |
$post_id | |
) { | |
// Add your logic here that will give you a dynamic id for gravity form | |
// For example, if your post has a "post meta" that stores a gravity form ID, you can | |
// use the $post_id to find the dynamic gravity form ID of the post meta . | |
return $gravity_form_id; | |
}, | |
10, | |
2 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment