0

I m learning to develop plugin and I am getting error on activation saying

The plugin generated 157 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 tried removing and making a new one but same error. here is my code (basic PHP comment to start a plugin, nothing fancy).

/*
Plugin Name: Awesomeness
Plugin URI: http://www.example.com/
Author URI: http://www.example.com/
Author: abc
Description: Just a fun plugin
*/
function fubs(){
    error.log("this is working");
}
register_activation_hook(__FILE__,'fubs');

There is no white space before or ending on PHP code.

localhost
  • 822
  • 2
  • 20
  • 51
  • Possible duplicate of [The plugin generated X characters of unexpected output during activation (WordPress)](https://stackoverflow.com/questions/4074477/the-plugin-generated-x-characters-of-unexpected-output-during-activation-wordpr) – T.Todua Dec 24 '18 at 00:04

1 Answers1

3

error is an undefined constant in your PHP code. You try to mix JavaScript with PHP, so PHP prints an error message.

Solution: Use PHP code in PHP and JavaScript code in JavaScript.

fuxia
  • 62,923
  • 6
  • 54
  • 62