• I’m trying to hide or show a couple of links depending on whether a plugin is activated or not. Below is the simple code I am using in the header.php file, after the body tag. The code always spits out the else case. (Currently attempting to detect wp-cache, which I know is activated). Is the Plugin information not available to WordPress when the header file is read? Is there another solution? Thanks!

    <?php if (function_exists('wp-cache'))
      {
      	echo <li>this function exists</li>;
      }else	{
      	echo <li>this function does not exist</li>;
    }?>
Viewing 1 replies (of 1 total)
  • Looking into the source of wp-cache it seems there is no function ‘wp-cache’. That’s probably the reason why the else statement is chosen. Try for instance ‘wp_cache_postload’.

Viewing 1 replies (of 1 total)
  • The topic ‘Detecting activated plugin with function_exists?’ is closed to new replies.