PHP code example of jmslbam / wp-cli-base-command

1. Go to this page and download the library: Download jmslbam/wp-cli-base-command library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jmslbam / wp-cli-base-command example snippets




use \JMSLBAM\WP_CLI\Base_Command;

class Import extends Base_Command {

    function import( $args, $assoc_args ) {

        $this->start_bulk_operation();

        // Optional: Disable a bunch of pre-defined plugin actions
        $this->disable_hooks();

        // Optional: Call "free_up_memory" after importing X amount of posts
        $this->free_up_memory();

        // Finalize your command
        $this->end_bulk_operation();
    }
}