Is there a way to detect whether a plugin is present in WordPress and output conditional code?
Here is why I want to do that…
I’m using the WordPress SEO Yoast plugin, and need to change the default title tag to get it to work properly e.g.
<title>
<?php
wp_title( '|', true, 'right' );
?>
</title>
Needs to be changed to …
<title><?php wp_title(''); ?></title>
That’s fine, but what if I uninstall SEO Yoast at some point and forget to switch the code back? To be safe I’d like to have some conditional code that says..
If the SEO Yoast plugin is present, change the title code, if not, output the default title code.
Is there a simple way to do this?
Thanks
You can try
is_plugin_activefunction (In the front end, in a theme, etc)More here.
Update: