I am having a small issue where i need to call add_action method which is conditional. Basically here, first checking whether the plugin active or not by admin_init action. If true then i need another add_action call from that action.

Please find the scenario what i am looking for:

        function check_some_other_plugin() {
            if ( is_plugin_active('some-plugin.php') ) {
                    //if true then vc_before_init action will run
                    add_action( 'vc_before_init', 'vc_master_home_slider' );
        add_action( 'admin_init', 'check_some_other_plugin' );

        function vc_master_home_slider() {
            //my stuff

I will really appreciate if somebody answer me to find actual way to get rid of this issue.


just check inside the action ^^

add_action( 'vc_before_init', 'vc_master_home_slider' );

function vc_master_home_slider(){
    //Do stuff.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.