Hey @boonebgorges thanks for reporting this. We’ll look into this for the next release. Checking the constant makes sense here.
If you want a temporary fix you can comment out that line where we remove the cached results in metaslider_plugin_is_installed().
wp_cache_delete('plugins', 'plugins');
@boonebgorges Thanks for reporting this. The feedback makes sense – look for this to be fixed in an upcoming release.
Hi Steve,
This bug is still present in the latest release. Can you please flag this problem with your team to address in an upcoming release?
Thanks!
Hi @r-a-y
Yes, thanks for raising this. This will be 100% be fixed in an upcoming release.
Hi Steve,
This bug is still present. Can you please flag this with your team for an upcoming release?
@r-a-y Thanks. This is assigned to an upcoming release: probably the one after next.
Hi team – I noticed that version 3.29.1 still doesn’t have a fix for this issue.
If it’s impossible for your team to change the approach for some reason, perhaps you’d consider adding a short-circuit filter instead:
function metaslider_plugin_is_installed($name = 'ml-slider')
{
$pre = apply_filters( 'metaslider_pre_plugin_is_installed', null );
if ( null !== $pre ) {
return $pre;
}
// ...
This way, installations like ours could provide our own, more performant check.
In the absence of a fix, we’re forced to patch the plugin each time it’s updated, which is not ideal (we have forgotten once or twice in the last year!).
Thanks again for the plugin and for your attention to the issue.
Thanks @boonebgorges. We do currently have this scheduled for an upcoming release.
Hi @boonebgorges,
please test this beta version that includes the filter you suggested:
add_filter( 'metaslider_pre_plugin_is_installed', function( $value, $name ) {
if ( file_exists( trailingslashit( WP_PLUGIN_DIR ) . $name . '/' . $name . '.php' ) ) {
$value = $name . '/' . $name . '.php';
}
return $value;
}, 10, 2 );
Let me know if this approach works for you.
Regards
Updated sample code to return false if plugin is not installed:
add_filter( 'metaslider_pre_plugin_is_installed', function( $value, $name ) {
if ( file_exists( trailingslashit( WP_PLUGIN_DIR ) . $name . '/' . $name . '.php' ) ) {
return $name . '/' . $name . '.php';
} else {
return false;
}
}, 10, 2 );
Our testings shows the filter only works 60% of the times. There are a couple of calls on ml-slider.php that can’t trigger the filter.
define('METASLIDER_BASE_URL', plugin_dir_url(metaslider_plugin_is_installed('ml-slider')));
$slug = metaslider_plugin_is_installed('ml-slider-pro');
We’re delaying a solution for this issue in order to carefully review and provide a better solution.
Regards