wp-load.php redeclares classes

Question

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.

0
, , manc 10 years 2013-03-30T09:02:35-05:00 0 Answers 161 views 0

Leave an answer

Browse
Browse