Doing wordpress plugin development, I am creating a table (while installing the plugin) with the following string:
$sql = "CREATE TABLE (query skipped)..."; /*someting*/
For example: I have this
register_activation_hook( __FILE__, 'my_plugin_install' );
function my_plugin_install(){
$sql = "CREATE TABLE (query skipped)..."; /*someting*/
echo $sql;
}
The problem is there is some error with this query and and I want to see the output of $sql using php.
But the above code doesn’t echo anything when plugin is installed. Any way to see the ouput?
It’s not possible to see the
echo
output, as the activation hook runs and refreshes the page. Two options:Die:
Log to file
Did you define the plugin header at the top of the file? Try to use the code like this and activate the plugin you will see the error in the admin panel.