0

I've put about 4 hours into trying to solve this issue. Please Help!

I've been working on developing my first custom plugin. Everything was going well until I started references files in subdirectories in my plugin. Here's the complete error I'm seeing every time I activate the plugin:

"The plugin generated 1521 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."

My plugin file hierarchy is as follows: Main File: wp-content/plugins/myplugin/index.php Database Building File: wp-content/plugins/myplugins/DB/initialize.php

In my index.php file, I'm calling the initialize.php file using the register_activation_hook function.here's the whole code:

add_action('admin_menu', 'form_forge_options');
include_once dirname(__FILE__) . '/DB/initialize_database.php';
register_activation_hook(__FILE__ , 'bbp_g_init_database');
AVI
  • 5,516
  • 5
  • 29
  • 38
  • http://stackoverflow.com/questions/7725615/the-plugin-generated-xxx-characters-of-unexpected-output-during-activation?rq=1 – Jitendra Popat Feb 01 '16 at 05:12
  • Possible duplicate of [x characters generated by WordPress plugin during activation](https://stackoverflow.com/questions/4074477/x-characters-generated-by-wordpress-plugin-during-activation) – T.Todua Dec 24 '18 at 00:02

2 Answers2

1
  1. I've often found that the cause of this error is whitespace (or anything else) before the opening tag.
  2. Use after the plugin(means at start) header ob_start(); i hope will help you:>
Sajid anwar
  • 1,194
  • 14
  • 41
0

I've often found that the cause of this error is whitespace (or anything else) before the opening <?php tag or after the closing ?> tag. You can leave the closing tag off to avoid the latter issue.

However, after looking around on Google, it appears there are other possible reasons for this error message, and even a plugin that will help you debug this specific issue: Debug Plugin Activation Errors

Linnea Huxford
  • 430
  • 2
  • 10
  • 1. I've often found that the cause of this error is whitespace (or anything else) before the opening tag. 2. Use after the plugin header ob_start(); i hope will help you – Sajid anwar Feb 01 '16 at 05:11