wp-frontend-profile icon indicating copy to clipboard operation
wp-frontend-profile copied to clipboard

Plugin not returning value correctly & causing fatal error.

Open Glowtayyab opened this issue 5 months ago • 0 comments

Hey there, while debugging an issue from one of our users we found that your plugin is currently not returning a value from one of your hooked filters.

In the following function, you are conditionally returning a value. This should probably always return the $plugins_array even if you aren’t changing it.

It’s located in:

/wp-front-end-profile/admin/class-wpfep-shortcodes-button.php:96

We have confirmed that returning the array fixes the Fatal errors thrown in our plugins as well.

This likely has impacts on other plugins as well until it’s resolved.

The full filter function should probably be:

public function enqueue_plugin_scripts($plugin_array) {

global $pagenow;

$posttype = get_post_type(get_the_ID());

if (('page' === $posttype && 'post.php' === $pagenow) || ('page' === $posttype && 'post-new.php' === $pagenow)) {

    // enqueue TinyMCE plugin script with its ID.

    $plugin_array['wpfep_button'] = plugins_url('/assets/js/wpfep-tmc-button.js', dirname(__FILE__));

    return $plugin_array;
}

return $plugin_array;

}

ref: https://wordpress.org/support/topic/plugin-not-returning-value-correctly-causing-fatal-error/

Glowtayyab avatar Sep 11 '24 11:09 Glowtayyab