开发者

“headers already sent” message, issue in WordPress plugin

开发者 https://www.devze.com 2023-03-19 16:37 出处:网络
开发者_运维技巧I have created a WordPress plugin. while i am going to activate the plugin facing following error:
开发者_运维技巧

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);
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消