0

I am creating a WordPress plugin for get a quote .

When I try to activate the plugin a error

The plugin generated 123 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 searched internet and found that it is caused by spaces or new lines before the opening <?php tag or after the closing ?> tag. I checked my files and remove all that type of spaces and try to reinstall my plugin.But still the error exists and also it create some errors in my other plugin functions.

Below is my plugin script

<?php

/*

Plugin Name: get_a_quote
Plugin URI: http://galtech.org/beta.com
Version: 0.8.04b
*/

//ob_start();
error_reporting(E_ALL);
global $wpdb;
$get_a_quote_table = $wpdb->prefix . 'quote';
$get_a_quote_table_projectinfo = $wpdb->prefix . 'projectinfo';
$get_a_quote_table_settings = $wpdb->prefix . 'get_a_quote_settings';
define('GET_A_QUOTE_TABLE', $wpdb->prefix . 'quote');
define('GET_A_QUOTE_TABLE_PROJECTINFO', $wpdb->prefix . 'projectinfo');
define('GET_A_QUOTE_TABLE_SETTINGS', $wpdb->prefix . 'get_a_quote_settings');
/*define(NETWORKS_INV_TABLE_PICTURES, $wpdb->prefix . 'pictures');
define(STAFF_PHOTOS_DIRECTORY, WP_CONTENT_DIR . "/uploads/staff-photos/");*/
require_once( dirname (__FILE__).'/install.php' );
require_once( dirname (__FILE__).'/admin/admin.php' );
//require_once( dirname (__FILE__).'/functions.php' );
//trigger_error(ob_get_contents(),E_USER_ERROR);
//echo get_option('plugin_error');
?>
BenMorel
  • 34,448
  • 50
  • 182
  • 322
rohit
  • 145
  • 1
  • 5
  • 14
  • 1
    Possible duplicate of [x characters generated by WordPress plugin during activation](https://stackoverflow.com/questions/4074477/x-characters-generated-by-wordpress-plugin-during-activation) – brasofilo Mar 12 '18 at 16:30

2 Answers2

0

I know the question is a few months old, so not sure if you still need an answer. However, that message means there is output; any output. So it does not have to be spaces or text outside your php tags, it can also be a echo or a printf or even a warning or error. Best way to determine where it comes from is by selectivly commenting out your code and activate the plugin to see when it stops showing. Usually it is not a big deal though.

Bert
  • 350
  • 3
  • 11
0

1) Remove extra spacing in the inner pages or plugin pages.

2) Remove the inline styling in the pages or plugin pages.

It worked for me everytime and I have used many times the same method when the problem error in the plugin page or Wordpress page.

brasofilo
  • 25,496
  • 15
  • 91
  • 179