Support » Developing with WordPress » Deactivate plugins on a Print Template

  • Resolved crillemok


    Hi folks,
    I have a print template activated on a website, and wonder if anyone knows what I can add in the code to deactivate plugins on this template:

    The problem is that a sticky popup is included when using the printing template, for printing.

    Can this be used:
    <?php deactivate_plugins( plugin_basename( __FILE__ ) ); ?>

    In case, should I just replace “plugin_basename” with the folder name of the plugin?
    What should “__FILE__” be replaced with?

    • This topic was modified 11 months, 2 weeks ago by  crillemok.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • I would suggest that you are approaching this from entirely the wrong angle!

    Most plugins add specific CSS classes, and you should use a print style sheet to hide those elements. For example, on that page the yellow popup has a class of “sticky-popup”, so your print style sheet should contain

    .sticky-popup { display: none; }

    If you don’t have a specific print style sheet you can add one to your normal styles.css, or via the Customiser, with this code around it:

    @media print {

    What I think you need is to not display the popup when on this page, so add this to your custom css:

    .page-template-template-print .sticky-popup {
     display: none;

    Thank you guys a lot for your input!
    Problem solved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Deactivate plugins on a Print Template’ is closed to new replies.