Skip to content

Commit

Permalink
support value passed to --with_attachments (fix wp-cli#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Droz committed Jul 12, 2018
1 parent 776d33a commit 8fa3ecb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Export_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public function __invoke( $_, $assoc_args ) {
'with_attachments',
$defaults['with_attachments']
);
$this->export_args['with_attachments'] = preg_match('/^(?:y|yes|1|true)$/i', (string)$this->export_args['with_attachments']); // nb: (string)TRUE === "1"

if ( !function_exists( 'wp_export' ) ) {
self::load_export_api();
Expand Down
2 changes: 1 addition & 1 deletion src/WP_Export_Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private function post_type_where() {
return;
}

if ( $this->filters['with_attachments'] == FALSE && ( !$this->filters['post_type'] || !in_array( 'attachment', $this->filters['post_type'], TRUE ) ) ) {
if ( $this->filters['with_attachments'] && ( !$this->filters['post_type'] || !in_array( 'attachment', $this->filters['post_type'], TRUE ) ) ) {
unset( $post_types['attachment'] );
}

Expand Down

0 comments on commit 8fa3ecb

Please sign in to comment.