diff --git a/README.md b/README.md index 2b0f40a..7003149 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Use [HtmlPageDom](https://github.com/wasinger/htmlpagedom) in conjunction for jQ This code will replace any instance of "foo" on the web page with "bar": ``` -add_filter( 'final_output', function($output) { +add_filter( 'final_output', function( $output ) { return str_replace( 'foo', 'bar', $output ); }); ``` diff --git a/output-buffering.php b/output-buffering.php index e25d76d..6e7ef7a 100644 --- a/output-buffering.php +++ b/output-buffering.php @@ -4,7 +4,7 @@ * Plugin Name: Output Buffering * Plugin URI: https://github.com/dmhendricks/wordpress-output-buffering * Description: Buffers the entire WP process, capturing the final output for manipulation. - * Version: 1.0.4 + * Version: 1.0.5 * Author: Daniel M. Hendricks * Original Author: kfriend (https://stackoverflow.com/users/419673/kfriend) * Author URI: https://www.danhendricks.com @@ -80,7 +80,7 @@ private function get_load_screens() { */ private function can_load() { - if( strpos( $_SERVER['REQUEST_URI'], '/wp-json' ) === 0 ) return false; + if( strpos( $_SERVER['REQUEST_URI'], '/wp-json' ) === 0 || ( defined( 'WP_CLI' ) && WP_CLI ) ) return false; $load_screens = $this->get_load_screens(); $load_admin = is_admin() && in_array( 'admin', $load_screens );