FancyThemes / wp-advanced-excerpt

A WordPress plugin that allows you to control the appearance of post excerpts
GNU General Public License v3.0
23 stars 7 forks source link

Undefined index: REQUEST_METHOD when WP is called from CLI #44

Open archon810 opened 7 years ago

archon810 commented 7 years ago

Hi,

Using the latest version 4.2.3 of the plugin and with notices enabled, I'm seeing only one notice in our environment, but it repeats thousands of times for us because we have a script loading WP and doing some stuff on the command line, and wp-advanced-excerpt doesn't check for the definition here:

if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_REQUEST['page'] ) && 'advanced-excerpt' === $_REQUEST['page'] ) {

That's line 41 of advanced-excerpt/class/advanced-excerpt.php.

Undefined index: REQUEST_METHOD

The script that calls this from command line does this:

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

I'd rather not have to fix the code locally and keep a forked copy, so I'm hoping you can do so in the main repo and release an update.

Thanks.