“headers already sent” message, issue in WordPress plugin
I have created a WordPress plugin. while i am going to activate the plugin facing following error:
The plugin generated 250 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.
I have checked for white spaces and characters before the PHP starting tag and closing tag. But error remains.
Try to remove all comment lines and fill the white spaces in the entire program code. This may help.
You remove the php close tag ( ?> ) from end of every file ;
when you activate the plugin just check if table already exist or not .
i remove the issue by the code
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
$sql = "CREATE TABLE {$table_name}(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(250),
email VARCHAR(250),
PRIMARY KEY (id)
);";
dbDelta($sql);
}
精彩评论