Support » Plugin: CMP - Coming Soon & Maintenance Plugin by NiteoThemes » hook enable and disable with WP All Import

  • Resolved Chritchan

    (@chritchan)


    Hi!
    I would like to activate the maintenance mode with WP All Import on pmxi_before_xml_import (enable) and pmxi_after_xml_import (disable).

    Can you tell me if it’s possible??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Chritchan

    (@chritchan)

    Ho yes it’s possible! I’ve just found the solution.
    I hope that will help someone…

    Compatible with CMP Version 4.1.2 and WP All Import Version 4.7.3

    function before_xml_import( $import_id ) {
        if ( class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) {
            update_option('niteoCS_status', '1');
            CMP_Coming_Soon_and_Maintenance::cmp_purge_cache();
        }
        /**
         * Do your other stuff
         */
    }
    add_action('pmxi_before_xml_import', 'before_xml_import', 10, 1);
    
    function after_xml_import( $import_id, $import ) {
        if ( class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) {
            update_option('niteoCS_status', '0');
            CMP_Coming_Soon_and_Maintenance::cmp_purge_cache();
        }
        /**
         * Do your other stuff
         */
    }
    add_action( 'pmxi_after_xml_import', 'after_xml_import', 10, 2 );
    Plugin Author Ales

    (@alesmal)

    Hey, @chritchan indeed working solution, very nice!

    Ales

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.