Open ghost opened 6 years ago
Isn't it because there is a filter by the exact name on line 633 in caldera-forms/classes/forms.php?:
$newform = apply_filters( 'caldera_forms_create_form', $newform);
When I comment out that line, the code in my function is not executed twice.
Well, if I add this as the first thing in my function, it seems that I can avoid the filter being fired:
remove_filter( 'caldera_forms_create_form', 'omk_create_page' );
But still: Is it a good idea having a filter and an action with the same name?
WordPress Version: 4.8.1 PHP Version: 7.1.8-2+ubuntu16.04.1+deb.sury.org+4 MySQL Version: 5.7.19 Caldera Forms Version: 1.5.6 WP_DEBUG: 1
Does Your Issue Persist When You Disable All Other Plugins and Switch To The Default Theme?
I installed Caldera Forms in another, clean site with Twenty Seventeen theme and all other plugins disabled. I put my code in the themes functions.php and the issue persists in that installation. (WordPress Version: 4.8.1 PHP Version: 5.6.30 MySQL Version: 5.5.51 Caldera Forms Version: 1.5.6.1 WP_DEBUG: 1)
What Is The Unexpected Behaviour?
I’m trying to use the caldera_forms_create_form hook to execute code that will create a page programmatically, containing the form. My problem is that any code I put in my function attached to add_action is executed twice, both when creating an entirely new form and when cloning an existing form. Lets' say I'm just doing this in the themes functions.php or a functionality plugin:
That will output this to debug.log:
[18-Sep-2017 21:07:11 UTC] hello world [18-Sep-2017 21:07:11 UTC] hello world
Why is that? Am I not using the hook correctly?
What PHP Errors Have You Logged While Reproducing This Bug?
None.
What JavaScript Errors Have You Seen While Reproducing This Bug?
I only see this, after the new form has loaded: "downloadable font: rejected by sanitizer (font-family: "dashicons" style:normal weight:normal stretch:normal src index:0) source: http:///wp-includes/fonts/dashicons.eot dashicons.css:1:12"