Title: plugin development &#8212; cannot redeclare function
Last modified: August 18, 2016

---

# plugin development — cannot redeclare function

 *  [oce](https://wordpress.org/support/users/josepo/)
 * (@josepo)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/plugin-development-cannot-redeclare-function/)
 * I’m writing a plugin and running into some issues.
 * I have an activation function, which sets up a table I’m using; I also have an
   admin page, under the management category. After activating, which works fine,
   when I go to the admin page I get:
 * `Fatal error: Cannot redeclare dumb_setup() (previously declared in /path/.../
   wp-content/plugins/dumb_plugin_test.php:10) in /path/.../wp-content/plugins/dumb_plugin_test.
   php on line 8`
 * Minimal code that repeats this error is at [http://pastie.caboo.se/123913](http://pastie.caboo.se/123913)
 * Thanks….

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Adam Brown](https://wordpress.org/support/users/adamrbrown/)
 * (@adamrbrown)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/plugin-development-cannot-redeclare-function/#post-660665)
 * Hmm. That’s weird. I don’t know what exactly in your code would cause that. But
   a side point. Shouldn’t this:
 *     ```
       register_activation_hook(basename(__FILE__), 'dumb_setup()');
       ```
   
 * say this:
 *     ```
       register_activation_hook(basename(__FILE__), 'dumb_setup');
       ```
   
 * ?
 *  [fitztrev](https://wordpress.org/support/users/fitztrev/)
 * (@fitztrev)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/plugin-development-cannot-redeclare-function/#post-660684)
 * josepo: That is indeed weird. I’m not sure of the reason myself. I rewrote it
   quickly with a simple class structure and it seems to be working just fine now.
   [http://pastebin.ca/803336](http://pastebin.ca/803336)
 * P.S. adamrbrown is correct. No parentheses needed to specify the dumb_setup function.
 *  [Adam Brown](https://wordpress.org/support/users/adamrbrown/)
 * (@adamrbrown)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/plugin-development-cannot-redeclare-function/#post-660685)
 * I haven’t tested, but I think this is your problem now that I think about it 
   again:
 *     ```
       add_management_page("dumb", "dumb", 0, __FILE__);
       ```
   
 * It’s trying to include your code a second time when you go to your admin page.
   Change __FILE__ to something else (so your plugin has 2 files) and see what happens.
 *  Thread Starter [oce](https://wordpress.org/support/users/josepo/)
 * (@josepo)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/plugin-development-cannot-redeclare-function/#post-660736)
 * Thanks, that works, though I don’t really get the file-inclusion thing, as it
   gets parsed but stuff defined in there doesn’t seem to fall under the scope of
   other things…whatever.
 *  [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/plugin-development-cannot-redeclare-function/#post-660814)
 * Nevermind.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘plugin development — cannot redeclare function’ is closed to new replies.

## Tags

 * [development](https://wordpress.org/support/topic-tag/development/)
 * [fatal error](https://wordpress.org/support/topic-tag/fatal-error/)
 * [redeclare](https://wordpress.org/support/topic-tag/redeclare/)

 * 5 replies
 * 4 participants
 * Last reply from: [scribu](https://wordpress.org/support/users/scribu/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/plugin-development-cannot-redeclare-function/#post-660814)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
