WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to load WordPress options within a standalone PHP file. The file is located in /wp-content/plugins/plugin-name/file.php. I have used the following to open wp-load.php:

if (file_exists('../../../wp-load.php')) {
    require_once ('../../../wp-load.php');

Doing so outputs the following error:

Fatal error: Cannot redeclare some_plugin_function() (previously declared in /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/plugin-name/class-frontend.php:5) in /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/plugin-name/class-frontend.php on line 12

Removing all code from class-frontend.php does solve the issue, but of course I need that file. class-frontend.php is not called within the standalone PHP file so am unsure why this is happening.

share|improve this question

This error has nothing to do with wp-load.php. You are declaring the 'some_plugin_function' function twice within your plugin file. The error message tells you exactly where to look.

You don't need to call class-frontend.php from your stand-alone PHP file to get the error. It's in a plugin, so as long as that plugin is active, it will be parsed.

share|improve this answer
I looked there and it is not declared anywhere else. There is no error anywhere else on any other file. I find it odd as I don't call class-frontend.php in the file at all. – manc Mar 30 '13 at 15:54
Please post the code from class-frontend.php – vancoder Mar 30 '13 at 15:56
its a lot of code but know it has nothing to do with the error – manc Mar 30 '13 at 16:41
It has everything to do with the error. – vancoder Mar 30 '13 at 17:23
this is the only part of the code that mentions the standalone file: FB.Event.subscribe('comment.create', function(response) { $.post("<?php echo plugins_url( 'plugin-name/standalone.php' , dirname(__FILE__) ); ?>", { id: response.commentID, url: response.href } ); } ); – manc Mar 31 '13 at 10:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.