Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

wdlyons on "Correct metgod to include wp-load.php"

$
0
0

Hi,

I submitted the plugon and received the following email back from Wordpress:

Including wp-config.php, wp-blog-header.php, wp-load.php, or pretty much any other WordPress core file that you have to call directly via an include is not a good idea and we cannot approve a plugin that does so unless it has a very good reason to load the file(s). It is prone to failure since not all WordPress installs have the exact same file structure.

Usually plugins will include wp-config.php or wp-load.php in order to gain access to core WordPress functions, but there are much better ways to do this.

It's best if you tie your processing functions (the ones that need but don't have access to core functions) into an action hook, such as "init" or "admin_init".

Please consult the Plugins API reference for more information: http://codex.wordpress.org/Plugin_API

If you're trying to use AJAX, please read this: http://codex.wordpress.org/AJAX_in_Plugins

When you've corrected your code, reply to this email with the updated code attached, or provide a link to the new code.

However, I do not use include and the only file I call is wp-load.php

The code I use to do this is:

$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
require_once( $parse_uri[0] . 'wp-load.php' );

Can anyone point me in the right direction to what I need to be using if this is not accepted.

I call that file because withput it I get a

Fatal error: Call to undefined function error

Thanks

Warwick


Viewing all articles
Browse latest Browse all 8245

Trending Articles