WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to create a link that allows site visitors to disable a plugin?

I'm using a plugin called "any mobile theme" which automatically detects if the visitor is on a mobile device and automatically switches to a mobile-friendly version of the themes. This works very well, but I would like to give them option to view the full (desktop) version if they prefer.

Is it possible to create a frontend link to disable a plugin (the mobile theme switcher) to achieve this?


share|improve this question
Add a link to the plugin’s code. – toscho Nov 13 '12 at 10:38
Thanks toscho: tinyurl.com/asktkzg – speedypancake Nov 13 '12 at 11:27
up vote 1 down vote accepted

According to the code …

// Embed Switch Links in Theme Via Shortcode
// [show_theme_switch_link]
function show_theme_switch_link_func( $atts ){
    $desktopSwitchLink  = get_option('show_switch_link_for_desktop');
    global $shown_theme;
    global $status;
    if ($shown_theme){
        $return = '<a rel="external" data-ajax="false" href="'.get_bloginfo('url').'?am_force_theme_layout=desktop" class="am-switch-btn godesktop">'.get_option('desktop_view_theme_link_text').'</a>';        
    } else {
        if ((!empty($status)) || ($desktopSwitchLink == 'yes')){
            $return = '<a href="'.get_bloginfo('url').'?am_force_theme_layout=mobile" class="am-switch-btn gomobile">'.get_option('mobile_view_theme_link_text').'</a>';
    return $return;
add_shortcode('show_theme_switch_link', 'show_theme_switch_link_func');

… you should be able to print a switch link with:

echo show_theme_switch_link_func();
share|improve this answer
Thanks again toscho :-) – speedypancake Nov 13 '12 at 12:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.