Skip to content

Instantly share code, notes, and snippets.

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 wpt00ls/b969f097a9e5a40d4fc83f35a47b624c to your computer and use it in GitHub Desktop.
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
/**
* 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