• hello,
    I’m trying to make messenger appear on only one page.

    and it installs itself on all the pages of my site.

    does anyone know?

    • This topic was modified 4 years, 2 months ago by arthichaud3.
Viewing 3 replies - 1 through 3 (of 3 total)
  • I would like to omit it from certain web pages (specifically landing pages), so I have a similar issue. If there is a way to do this, I’d love to hear it.

    Same here!

    One way would be to only enable the plugin for some pages. Create this file in wp-content/mu-plugins/important-filters.php with contents:

    <?php
    // make sure this isn't an admin page
    if (!preg_match('/wp-admin/', $_SERVER['REQUEST_URI'])) {
    	if (!preg_match('/my-chat-page/', $_SERVER['REQUEST_URI'])) {
                    // remove the plugin from active plugin list
    		add_filter('option_active_plugins', function($value, $option) {
    			if (($key = array_search("facebook-messenger-customer-chat/facebook-messenger-customer-chat.php", $value)) !== false) {
    				array_splice($value, $key, 1);
    			}
    			return $value;
    		}, 10, 2);
    	}
    }
    

    This will remove the facebook plugin from non-admin pages that don’t match “my-chat-page”.

    • This reply was modified 4 years, 1 month ago by zebfross. Reason: added comments
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how not to make it appear on every page?’ is closed to new replies.