Skip to content

Commit 6f487a0

Browse files
Merge pull request #90 from austinginder/issue-83-add-docs-for-where-argument
Add examples for exporting certain posts
2 parents 105871a + 814a1c7 commit 6f487a0

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,14 @@ Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
384384
$ wp db export --tables=$(wp db tables --all-tables-with-prefix --format=csv)
385385
Success: Exported to 'wordpress_dbase-db72bb5.sql'.
386386

387+
# Export certain posts without create table statements
388+
$ wp db export --no-create-info=true --tables=wp_posts --where="ID in (100,101,102)"
389+
Success: Exported to 'wordpress_dbase-db72bb5.sql'.
390+
391+
# Export relating meta for certain posts without create table statements
392+
$ wp db export --no-create-info=true --tables=wp_postmeta --where="post_id in (100,101,102)"
393+
Success: Exported to 'wordpress_dbase-db72bb5.sql'.
394+
387395
# Skip certain tables from the exported database
388396
$ wp db export --exclude_tables=wp_options,wp_users
389397
Success: Exported to 'wordpress_dbase-db72bb5.sql'.

src/DB_Command.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,14 @@ public function query( $args, $assoc_args ) {
365365
* $ wp db export --tables=$(wp db tables --all-tables-with-prefix --format=csv)
366366
* Success: Exported to 'wordpress_dbase-db72bb5.sql'.
367367
*
368+
* # Export certain posts without create table statements
369+
* $ wp db export --no-create-info=true --tables=wp_posts --where="ID in (100,101,102)"
370+
* Success: Exported to 'wordpress_dbase-db72bb5.sql'.
371+
*
372+
* # Export relating meta for certain posts without create table statements
373+
* $ wp db export --no-create-info=true --tables=wp_postmeta --where="post_id in (100,101,102)"
374+
* Success: Exported to 'wordpress_dbase-db72bb5.sql'.
375+
*
368376
* # Skip certain tables from the exported database
369377
* $ wp db export --exclude_tables=wp_options,wp_users
370378
* Success: Exported to 'wordpress_dbase-db72bb5.sql'.

0 commit comments

Comments
 (0)