Skip to main content
More clarification and a temporary workaround.
Source Link

I've encountered this issue a few times before. It's a simple matter of adding this to the top of your plugin beneath the comments block. It appears that the way plugin_basename returns the value doesn't play nicely with much else.

$basename = plugin_basename(__FILE__);

Then replace this line:

define( 'SEND_INVITATION_PLUGIN_BASENAME', plugin_basename(__FILE__) );

With this instead:

define( 'SEND_INVITATION_PLUGIN_BASENAME', $basename );

Updated based on feedback.

So it appears you're not getting accessing to the function plugin_basename, for the sake of a temporary workaround in your plugin add this function.

function the_plugin_basename($file) {
    $file = str_replace('\\','/',$file); // sanitize for Win32 installs
    $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
    $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
    $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
    $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs
    $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
    $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
    $file = trim($file, '/');
    return $file;
}

Then in your plugin change any references to the function plugin_basename(), to the_plugin_basename() instead. This will get us past the error of not being able to call that function and with a little luck, we might see another error telling us what is going on.

I've encountered this issue a few times before. It's a simple matter of adding this to the top of your plugin beneath the comments block. It appears that the way plugin_basename returns the value doesn't play nicely with much else.

$basename = plugin_basename(__FILE__);

Then replace this line:

define( 'SEND_INVITATION_PLUGIN_BASENAME', plugin_basename(__FILE__) );

With this instead:

define( 'SEND_INVITATION_PLUGIN_BASENAME', $basename );

I've encountered this issue a few times before. It's a simple matter of adding this to the top of your plugin beneath the comments block. It appears that the way plugin_basename returns the value doesn't play nicely with much else.

$basename = plugin_basename(__FILE__);

Then replace this line:

define( 'SEND_INVITATION_PLUGIN_BASENAME', plugin_basename(__FILE__) );

With this instead:

define( 'SEND_INVITATION_PLUGIN_BASENAME', $basename );

Updated based on feedback.

So it appears you're not getting accessing to the function plugin_basename, for the sake of a temporary workaround in your plugin add this function.

function the_plugin_basename($file) {
    $file = str_replace('\\','/',$file); // sanitize for Win32 installs
    $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
    $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
    $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
    $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs
    $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
    $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
    $file = trim($file, '/');
    return $file;
}

Then in your plugin change any references to the function plugin_basename(), to the_plugin_basename() instead. This will get us past the error of not being able to call that function and with a little luck, we might see another error telling us what is going on.

Source Link

I've encountered this issue a few times before. It's a simple matter of adding this to the top of your plugin beneath the comments block. It appears that the way plugin_basename returns the value doesn't play nicely with much else.

$basename = plugin_basename(__FILE__);

Then replace this line:

define( 'SEND_INVITATION_PLUGIN_BASENAME', plugin_basename(__FILE__) );

With this instead:

define( 'SEND_INVITATION_PLUGIN_BASENAME', $basename );