ShahiLandin provides comprehensive WP-CLI commands for managing landing pages, experiments, and analytics from the command line. This is ideal for automation, bulk operations, and server administration.
Installation & Requirements
Prerequisites
- WP-CLI installed and configured
- WordPress 6.0 or higher
- ShahiLandin plugin activated
- PHP 7.4 or higher
list– List all landing pagesget– Get details of a specific landing pagecreate– Create a new landing pageupdate– Update an existing landing pagedelete– Delete a landing pageduplicate– Duplicate a landing pagestats– Get statistics for a landing pagetemplate-usage– Report template usageexperiments– Manage A/B test experiments--status=– Filter by post status--format=– Output format– The landing page ID (required)--format=– Output format (table, json, yaml)--title=– Landing page title (required)--status=– Post status (default:draft)--slug=– URL slug (auto-generated if omitted)--html=– HTML content--css=– CSS content– The landing page ID (required)--title=– New title--status=– New status--slug=– New URL slug– The landing page ID (required)--force– Skip trash and permanently delete– The landing page ID to duplicate (required)- Title (with “Copy” appended)
- HTML content
- CSS content
- Head assets (fonts, meta tags, scripts)
- Rendering mode
- All post meta
- Analytics data (views, conversions)
- URL slug (auto-generated)
- Post status (always set to draft)
- Experiment relationships
– The landing page ID (required)--format=– Output format (table, json, yaml)--format=– Output format (table, csv, json, yaml)– The original landing page ID (required)--name=– Name for the variant (default: “Variant A”)– The original landing page ID (required)--format=– Output format (table, csv, json, yaml)– The original landing page ID (required)--format=– Output format (table, json, yaml)– The original landing page ID (required)– The original landing page ID (required)--winner=– Declare a specific variant as the winner– The original landing page ID (required)--yes– Skip confirmation prompt0– Success1– Generic error2– Invalid arguments
Verifying WP-CLI Access
`bash
wp shahilandin –help
`
If installed correctly, you’ll see a list of available commands.
Command Structure
All ShahiLandin commands follow this pattern:
`bash
wp shahilandin
`
Available Commands
Landing Page Commands
List Landing Pages
Display all landing pages in a formatted table.
Syntax:
`bash
wp shahilandin list [–status=
`
Options:
– Values: publish, draft, pending, private, any
– Default: any
– Values: table, csv, json, yaml
– Default: table
Examples:
`bash
List all landing pages in table format
wp shahilandin list
List only published pages
wp shahilandin list –status=publish
Export all landing pages to JSON
wp shahilandin list –format=json > landings.json
Export published pages to CSV
wp shahilandin list –status=publish –format=csv > published.csv
`
Output:
`
+——+——————-+———+——-+————–+——————+———————+
| ID | Title | Status | Views | Conversions | Conversion Rate | Date |
+——+——————-+———+——-+————–+——————+———————+
| 123 | Summer Sale 2025 | publish | 5432 | 271 | 4.99% | 2025-11-15 10:23:45 |
| 124 | Product Launch | draft | 0 | 0 | 0.00% | 2025-11-20 14:12:33 |
+——+——————-+———+——-+————–+——————+———————+
`
Get Landing Page Details
Retrieve detailed information about a specific landing page.
Syntax:
`bash
wp shahilandin get
`
Arguments:
Options:
Examples:
`bash
Get details for landing page 123
wp shahilandin get 123
Get details in JSON format
wp shahilandin get 123 –format=json
Get details and pipe to file
wp shahilandin get 123 –format=yaml > landing-123.yaml
`
Output:
`
+——————+——————————–+
| Field | Value |
+——————+——————————–+
| ID | 123 |
| Title | Summer Sale 2025 |
| Slug | summer-sale-2025 |
| Status | publish |
| URL | https://example.com/landing/…|
| Views | 5432 |
| Conversions | 271 |
| Conversion Rate | 4.99% |
| Created | 2025-11-15 10:23:45 |
| Modified | 2025-11-28 09:15:22 |
+——————+——————————–+
`
Create Landing Page
Create a new landing page via command line.
Syntax:
`bash
wp shahilandin create –title=
`Options:
– Values: publish, draft, pending, private
Examples:
`bash
Create a simple draft landing page
wp shahilandin create –title=”My Landing Page”
Create and publish immediately
wp shahilandin create –title=”Black Friday Sale” –status=publish –slug=black-friday
Create with HTML content
wp shahilandin create –title=”Custom Page” –html=”
“
Create with both HTML and CSS
wp shahilandin create –title=”Styled Page” –html=”
” –css=”.hero { background: #333; }”
Create from file
wp shahilandin create –title=”Imported Page” –html=”$(cat landing.html)” –css=”$(cat styles.css)”
`
Success Output:
`
Success: Landing page created with ID: 125
View at: https://example.com/landing/my-landing-page
`
Update Landing Page
Update an existing landing page’s properties.
Syntax:
`bash
wp shahilandin update
`
Arguments:
Options:
Examples:
`bash
Update title
wp shahilandin update 123 –title=”Updated Title”
Publish a draft
wp shahilandin update 123 –status=publish
Change URL slug
wp shahilandin update 123 –slug=new-slug-2025
Update multiple fields
wp shahilandin update 123 –title=”Final Title” –status=publish –slug=final-slug
`
Success Output:
`
Success: Landing page 123 updated successfully.
`
Delete Landing Page
Delete a landing page (move to trash or permanently delete).
Syntax:
`bash
wp shahilandin delete
`
Arguments:
Flags:
Examples:
`bash
Move to trash
wp shahilandin delete 123
Permanently delete
wp shahilandin delete 123 –force
`
Success Output:
`
Success: Landing page 123 moved to trash.
`
Or with --force:
`
Success: Landing page 123 permanently deleted.
`
Duplicate Landing Page
Create an exact copy of an existing landing page.
Syntax:
`bash
wp shahilandin duplicate
`
Arguments:
Examples:
`bash
Duplicate landing page 123
wp shahilandin duplicate 123
`
Success Output:
`
Success: Landing page duplicated. New ID: 126
Edit at: https://example.com/wp-admin/post.php?post=126&action=edit
`
What Gets Duplicated:
What Doesn’t Get Duplicated:
Get Landing Page Statistics
Retrieve analytics data for a specific landing page.
Syntax:
`bash
wp shahilandin stats
`
Arguments:
Options:
Examples:
`bash
View statistics
wp shahilandin stats 123
Export stats to JSON
wp shahilandin stats 123 –format=json
Get stats for multiple pages (bash loop)
for id in 123 124 125; do
wp shahilandin stats $id –format=json >> all-stats.json
done
`
Output:
`
+——————+——–+
| Metric | Value |
+——————+——–+
| views | 5432 |
| conversions | 271 |
| conversion_rate | 4.99 |
| bounce_rate | 45.2 |
| avgtimeon_page | 125 |
+——————+——–+
`
Report Template Usage
Analyze which templates are being used across all landing pages.
Syntax:
`bash
wp shahilandin template-usage [–format=
`
Options:
Examples:
`bash
View template usage
wp shahilandin template-usage
Export to CSV for reporting
wp shahilandin template-usage –format=csv > template-usage.csv
`
Output:
`
+———————-+——-+
| Template | Count |
+———————-+——-+
| lead-generation | 45 |
| product-launch | 32 |
| webinar-registration | 28 |
| (unknown) | 12 |
+———————-+——-+
Total landing pages: 117
Pages with template metadata: 105
Pages without template metadata: 12
`
Experiment Commands
Manage A/B testing experiments via WP-CLI.
Create Experiment
Create a new A/B test experiment by duplicating a landing page as a variant.
Syntax:
`bash
wp shahilandin experiments create
`
Arguments:
Options:
Examples:
`bash
Create experiment with default name
wp shahilandin experiments create 123
Create with custom name
wp shahilandin experiments create 123 –name=”Green Button Test”
Create multiple variants
wp shahilandin experiments create 123 –name=”Variant A”
wp shahilandin experiments create 123 –name=”Variant B”
`
Success Output:
`
Success: Experiment variant created with ID: 127
Edit at: https://example.com/wp-admin/post.php?post=127&action=edit
`
List Experiment Variants
List all variants for a given landing page.
Syntax:
`bash
wp shahilandin experiments list
`
Arguments:
Options:
Examples:
`bash
List variants
wp shahilandin experiments list 123
Export to JSON
wp shahilandin experiments list 123 –format=json
`
Output:
`
+—–+——————-+—————————+——-+————-+——————+
| ID | Name | Title | Views | Conversions | Conversion Rate |
+—–+——————-+—————————+——-+————-+——————+
| 127 | Green Button Test | Summer Sale 2025 (Variant)| 2716 | 149 | 5.48% |
| 128 | Red Button Test | Summer Sale 2025 (Variant)| 2716 | 122 | 4.49% |
+—–+——————-+—————————+——-+————-+——————+
`
Get Experiment Statistics
Retrieve detailed statistics for an experiment including all variants.
Syntax:
`bash
wp shahilandin experiments stats
`
Arguments:
Options:
Examples:
`bash
View experiment stats
wp shahilandin experiments stats 123
Export to JSON for analysis
wp shahilandin experiments stats 123 –format=json > experiment-123.json
`
Output:
`
+———-+—–+——————-+——-+————-+——————+
| Type | ID | Name | Views | Conversions | Conversion Rate |
+———-+—–+——————-+——-+————-+——————+
| Original | 123 | Summer Sale 2025 | 5432 | 271 | 4.99% |
| Variant | 127 | Green Button Test | 2716 | 149 | 5.48% |
| Variant | 128 | Red Button Test | 2716 | 122 | 4.49% |
+———-+—–+——————-+——-+————-+——————+
Experiment Status: Active
`
Determine Experiment Winner
Get the winning variant based on conversion rate.
Syntax:
`bash
wp shahilandin experiments winner
`
Arguments:
Examples:
`bash
Find the winner
wp shahilandin experiments winner 123
`
Output:
`
Success: Winner: Green Button Test (ID: 127)
Conversions: 149
Conversion Rate: 5.48%
`
Stop Experiment
Stop an active experiment and optionally declare a winner.
Syntax:
`bash
wp shahilandin experiments stop
`
Arguments:
Options:
Examples:
`bash
Stop experiment without declaring winner
wp shahilandin experiments stop 123
Stop and declare winner
wp shahilandin experiments stop 123 –winner=127
`
Success Output:
`
Success: Experiment stopped successfully.
Winner set to: 127
`
Delete Experiment Variants
Remove all variants associated with an experiment.
Syntax:
`bash
wp shahilandin experiments delete-variants
`
Arguments:
Flags:
Examples:
`bash
Delete variants with confirmation
wp shahilandin experiments delete-variants 123
Delete without confirmation (automation-friendly)
wp shahilandin experiments delete-variants 123 –yes
`
Output:
`
Are you sure you want to delete 2 variant(s)? [y/n] y
Success: 2 variant(s) deleted successfully.
`
Bulk Operations
Batch Creating Landing Pages
Create multiple landing pages from a CSV file:
CSV Format (landings.csv):
`csv
title,status,slug,html,css
“Summer Sale”,”publish”,”summer-sale”,”
“,”.hero{color:red}”
“Product Launch”,”draft”,”product”,”
“,””
`
Script:
`bash
#!/bin/bash
while IFS=, read -r title status slug html css; do
# Skip header row
if [ “$title” = “title” ]; then continue; fi
wp shahilandin create \
–title=”$title” \
–status=”$status” \
–slug=”$slug” \
–html=”$html” \
–css=”$css”
done < landings.csv
`
Batch Publishing Drafts
Publish all draft landing pages:
`bash
Get all draft IDs and publish them
wp shahilandin list –status=draft –format=csv –fields=ID | tail -n +2 | while read id; do
wp shahilandin update $id –status=publish
done
`
Export All Landing Pages
Export complete data for all landing pages:
`bash
#!/bin/bash
Create export directory
mkdir -p landing-exports
Export list
wp shahilandin list –format=json > landing-exports/list.json
Export each landing page individually
wp shahilandin list –format=csv –fields=ID | tail -n +2 | while read id; do
wp shahilandin get $id –format=json > “landing-exports/landing-$id.json”
wp shahilandin stats $id –format=json > “landing-exports/stats-$id.json”
done
echo “Export complete: landing-exports/”
`
Cleanup Unused Variants
Delete experiment variants that have zero views:
`bash
Find and delete variants with no views
wp shahilandin list –format=json | jq -r ‘.[] | select(.Views == “0”) | .ID’ | while read id; do
echo “Deleting landing page $id (zero views)”
wp shahilandin delete $id –force
done
`
Automation Examples
Daily Stats Report
Send daily email with landing page statistics:
`bash
#!/bin/bash
daily-stats.sh
REPORT_FILE=”/tmp/landing-stats-$(date +%Y%m%d).txt”
echo “ShahiLandin Daily Statistics Report – $(date)” > $REPORT_FILE
echo “=========================================” >> $REPORT_FILE
echo “” >> $REPORT_FILE
wp shahilandin list –format=table >> $REPORT_FILE
Email the report
mail -s “Landing Pages Daily Report” admin@example.com < $REPORT_FILE
`
Add to crontab:
`cron
0 8 * /path/to/daily-stats.sh
`
Auto-Create Experiment Variants
Automatically create variants for new landing pages:
`bash
#!/bin/bash
Watch for new published landing pages and create test variants
Get landing pages created in the last hour
wp post list –posttype=shahilanding –poststatus=publish –format=csv –fields=ID,postdate | \
awk -F, -v date=”$(date -d ‘1 hour ago’ ‘+%Y-%m-%d %H:%M:%S’)” ‘$2 > date {print $1}’ | \
tail -n +2 | while read id; do
echo “Creating experiment variant for landing $id”
wp shahilandin experiments create $id –name=”Auto-Generated Variant”
done
`
Backup Landing Pages
Regular backup of all landing page content:
`bash
#!/bin/bash
backup-landings.sh
BACKUP_DIR=”/backups/shahilandin/$(date +%Y%m%d)”
mkdir -p “$BACKUP_DIR”
Export all landing pages
wp shahilandin list –format=json > “$BACKUP_DIR/landings.json”
Export individual pages with full details
wp shahilandin list –format=csv –fields=ID | tail -n +2 | while read id; do
wp post get $id –format=json > “$BACKUP_DIR/post-$id.json”
done
Compress backup
tar -czf “$BACKUPDIR.tar.gz” “$BACKUPDIR”
rm -rf “$BACKUP_DIR”
echo “Backup complete: $BACKUP_DIR.tar.gz”
`
Error Handling
Common Errors
Error: Landing page not found
`
Error: Landing page not found.
`
Solution: Verify the ID exists with wp shahilandin list
Error: Title is required
`
Error: Title is required.
`
Solution: Always provide --title when creating landing pages
Error: Invalid post status
`
Error: Invalid parameter(s): status
`
Solution: Use valid status values: publish, draft, pending, private
Exit Codes
WP-CLI commands return standard exit codes:
Example usage in scripts:
`bash
if wp shahilandin get 123 > /dev/null 2>&1; then
echo “Landing page exists”
else
echo “Landing page not found”
fi
`
Performance Considerations
Batch Operations
When performing bulk operations:
--format=json or --format=csv for machine parsingLarge Datasets
For sites with thousands of landing pages:
`bash
Process in batches
BATCH_SIZE=100
TOTAL=$(wp shahilandin list –format=count)
for ((i=0; i<$TOTAL; i+=$BATCH_SIZE)); do
wp shahilandin list --format=csv --fields=ID | \
tail -n +2 | head -n $BATCH_SIZE | while read id; do
# Process each ID
wp shahilandin stats $id
done
echo "Processed batch $((i/$BATCH_SIZE + 1))"
sleep 2 # Rate limiting
done
`
Tips & Best Practices
wp db export first--dry-run where available: Preview changes before applying—
For REST API automation, see the REST API Reference article.
Share this article
Still need help?
Our support team is ready to assist you with personalized guidance for your workspace.