I have some checks (e.g. in functions.php) to ensure that if a plugin (e.g. wpForo) is disabled, any custom code related to that plugin won't break the site.
In these cases a typical function will look like this (example with wpForo-related check):
function my_custom_wpforo_function() { if( function_exists('WPF') ) { // do something } } add_action('my_hook', 'my_custom_wpforo_function');
but there will be cases where the code in question is inside a specific wpForo event. For example, wpforo_loop_hook is triggered only inside a wpForo loop, so if the plugin is disabled, this event should never be triggered.
Am I right in thinking that in these types of events (that are only triggered if the plugin is active) I don't need to add a plugin check, and that I can simply leave the code as it is (example below) because it will never be executed if the plugin is disabled?
function my_custom_wpforo_event_function(){ // do something } add_action( 'wpforo_loop_hook', 'my_custom_wpforo_event_function' );
Thank you.
Yes, fawp, Everything is correct.