Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @webtoffee,

    The cookie modal doesn’t need to load on REST calls so the best way would be to just bail on a rest call similarly to how you bail with !is_admin().

    WP doesn’t have a convenient function to determine whether it’s a REST call when loading code fairly early, so it might be easiest to do add a function similar this answer on StackOverflow, then since you probably don’t need any code loading on REST calls, just add it to your plugin’s entry point. For example,

    function run_cookie_law_info() {
    	if (is_rest()) return;
    	$plugin = new Cookie_Law_Info();
    	$plugin->run();
    }
    run_cookie_law_info();

    Kevin (from MetaSlider)

    Plugin Author WebToffee

    (@webtoffee)

    Hi @mbeerli,

    We have analyzed this by installing both plugins in a dev site and have come up with a solution. Please use the below code snippet to your active theme’s functions.php. This would prevent the bar from appearing on metaslider edit pages.

    function wt_disable_cookie_bar($cookiebar , $slug )
    {	
    	if( defined( 'REST_REQUEST' ) && REST_REQUEST )
    	{
    		$cookiebar = '';
    	}
    	return $cookiebar;
    }
    add_filter('cli_show_cookie_bar_only_on_selected_pages','wt_disable_cookie_bar',10,2);

    Hope this helps.

    Hi @webtoffee

    Is it possible you can add this as a permanent fix to the plugin so users won’t have to add extra code to their site to fix the conflict?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pluging causing display problem with metaslider’ is closed to new replies.