Site icon Hip-Hop Website Design and Development

Check if MemberPress exists before add_action call

I have a custom plugin that checks if MemberPress exists in order to present membership only content in a modal dialog box.

Now I want to add a new feature to this plugin where I redirect the user to a different page based on login URL parameters, which I generate from the page the user came from. The problem is, this is achieved through :

add_action('mepr-process-login-redirect-url', 'some_mb_function');

But if MemberPress is not installed, that class mepr-process-login-redirect-url does not exist. How do I check to see if MemberPress is installed before making the add_action call?

I did try using the generalized WP call:

add_action('login_init', 'some_function');

But that is not execute if MemberPress is installed.

Catch 22. Any ideas?