NOTE: This tutorial can be used for any WordPress server-side debugging, but since this is a Formidable community, I'll pretend it's only Formidable hooks that we're debugging.
If you have a hook that either errors out or just doesn't do what you think it's supposed to, debug it. It's easier than it sounds.
Step 1: Set up your environment for debugging
Edit your wp-config.php file and add/change the following:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false);
Step 2: Create a debug output snippet
Place the following snippet on your server either via a snippet plugin (Code Snippets or WP Code) or add it to your functions.php
if (!function_exists('write_log')) { function write_log($log) { if (true === WP_DEBUG) { if (is_array($log) || is_object($log)) { error_log(print_r($log, true)); } else { error_log($log); } } } }
Step 3: Put debug statements all over the place in your code
e.g., write_log("form id: $form_id);
Step 4: Make the issue happen
Do your stuff via your website to hit the code you put your debug lines in.
Step 5: View the debug file
Use some sort of file manager to view the debug.log file that got created with your info in it.