1

I have developed a custom plugin in wordpress it was working fine but suddenly I got an unusual error stated as follows

Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /public_html/demo2/wp-content/plugins/my-plugin-custom/inc/admin/Settings.php on line 7

Here is what goes goes under line 7

<?php
/**
 * @package My Custom Plugin
 */ 

namespace Inc\admin;

class Settings {
    public function register() {
        add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
    }
}

Can anyone could help me out with this issue what exactly is going on I am really much confused

Usman Khan
  • 27
  • 7

2 Answers2

0

I fixed it by removing the white spaces thank you

Usman Khan
  • 27
  • 7
0

If there is no issue with namespace then you can try inserting namespace Inc\admin; after <?php [Maybe the 2nd line]