I am developing my plugin and I am getting this error:
The plugin generated 357954 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
Now my activation hook looks like this:
function _activate() {
global $wpdb;
require_once(ABSPATH . 'wp-content/plugins/my-plugin/sql.php');
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
and sql.php which does import like this:
$sql .= $wpdb->query($wpdb->prepare("CREATE TABLE IF NOT EXISTS `wp_car_makes` (
`makes_id` int(11) NOT NULL AUTO_INCREMENT,
`makes_name` varchar(60) NOT NULL DEFAULT '',
PRIMARY KEY (`makes_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=350170"));
$sql .= $wpdb->query($wpdb->prepare("INSERT INTO `wp_car_makes`
(`makes_id`,`makes_name`) VALUES
(1, 'Acura'),
(2, 'Alfa Romeo'),
.... and it has a 300k+ inserts
(350169, 'Yugo');
"));
Now - everything is imported properly in DB, and plugin is working OK, it's just that this error is annoying - and I don't have white-spaces after opening/closing tags etc...
Any tips why is this happening ?
require_once( plugin_dir_path( __file__ ) . 'sql.php' );