Last active
April 2, 2024 14:47
-
-
Save wpmudev-sls/534ffc14789609899299c9dc40b75a3e to your computer and use it in GitHub Desktop.
[Forminator Pro] - Fix conflict with registration magic plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: [Forminator Pro] Fix conflict with registration magic plugin | |
* Description: Fix conflict with registration magic plugin. | |
* Author: Prashant @ WPMUDEV | |
* Task: SLS-5959 | |
* Author URI: https://premium.wpmudev.org | |
* License: GPLv2 or later | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly. | |
} | |
add_action( 'wp_head', function(){ | |
global $wp_filter, $post; | |
if ( is_a( $post, 'WP_Post' ) && ! has_shortcode( $post->post_content, 'forminator_form' ) ) { | |
return; | |
} | |
$tag = 'wp_footer'; | |
$hook_method = 'floating_action'; | |
$hook_class = 'RM_Public'; | |
if ( ! isset( $wp_filter[$tag] ) ) { | |
return; | |
} | |
foreach ( $wp_filter[ $tag ]->callbacks as $key => $callback_array ) { | |
foreach ( $callback_array as $c_key => $callback ) { | |
if ( substr_compare( $c_key, $hook_method, strlen( $c_key ) - strlen( $hook_method ), strlen( $hook_method ) ) === 0 ) { | |
if ( $callback['function'][0] instanceof $hook_class ) { | |
unset( $wp_filter[ $tag ]->callbacks[ $key ][ $c_key ] ); | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment