WP-CLI commands
WP-ImmoMakler ships its own commands for WP-CLI, the WordPress command line. They let you set up a website without a browser: activate the licence, import properties, create templates for your page builder. This is intended for agencies that set up websites by script or over SSH, and for staging and demo environments.
The commands are available from version 5.72.0 as soon as WP-ImmoMakler is activated. For an overview, run:
wp immomaklerwp help shows the help for a command with all its options, for example wp help immomakler import run. The output of the commands is in English.
| Command | Purpose |
|---|---|
wp immomakler license |
Activate, check and deactivate the licence |
wp immomakler import |
Run the OpenImmo import and show its status |
wp immomakler cache |
Show the cache, flush it and prune it to its size limit |
wp immomakler attachments |
Count and delete orphaned attachments |
wp immomakler reset |
Delete all properties, contact persons and attachments, for a fresh start before a full sync |
wp immomakler starter-templates |
Install and remove starter templates in the page builder |
wp immomakler ai-search |
Test the AI search (PLUS and above) |
Licence
Section titled “Licence”Without an active licence, WP-ImmoMakler does not import any properties. The commands do the same as the licence page in the backend of your website (wp-admin). The licence key is never shown in full in any output, only with its first and last four characters.
Activate the licence
Section titled “Activate the licence”wp immomakler license activate <licence key>The command saves the licence key and registers the website’s address with the licence server. Without a licence key, it activates the one already saved on the website.
If activation fails, the command ends with an error and states the reason given by the licence server: for example an expired or unknown licence key, a licence key for a different edition than the one installed, or a reached limit of activated websites. If you specified a new licence key, the previous licence key stays saved with its status in this case.
If the licence server does not respond with a readable answer, for example with an error page, a website without previous licence data counts as active, as on the licence page, until the licence server responds again. The command points this out with a warning and ends without an error. Check the status again later with wp immomakler license status.
Check the licence
Section titled “Check the licence”wp immomakler license statuswp immomakler license status --format=jsonThe command queries the current status from the licence server and shows the status, edition, expiry date and the number of activated websites. If the licence server cannot be reached, it shows the saved status.
If the licence is not active for the website, the command ends with an error. In a script, this lets you activate the licence only when necessary:
wp immomakler license status || wp immomakler license activate "$LICENSE_KEY"--format accepts table (default), json, csv and yaml.
Deactivate the licence
Section titled “Deactivate the licence”wp immomakler license deactivateThe command releases the website’s activation, for example before you delete a staging environment. The licence key remains saved on the website.
Import
Section titled “Import”The commands work with the import directory set in the backend of your website (wp-admin) under WP-ImmoMakler → Property Importer, and run the same import as the automatic import.
Run the import
Section titled “Run the import”wp immomakler import runwp immomakler import run --forcewp immomakler import run --wait --quietThe command imports the OpenImmo files in the import directory. It imports even if the automatic import is switched off on the website, and it shows the import log as it goes, that is, which file and which property is currently being processed. With the general WP-CLI parameter --quiet, it shows neither the log nor the figures, only errors; the log is available as usual in the log file in the import directory, and the exit code tells you whether the import worked.
The web server’s time limit does not apply to WP-CLI. A pass therefore imports without a time limit until no file is left, until you cancel it with Ctrl+C or until memory runs low (with a memory_limit of -1 there is no such limit); the next pass resumes at the same point. With --time-limit=<seconds>, each pass ends after that time, like a pass started by the website.
Without --wait, the command runs one pass and reports how many files are left. With --wait, it repeats the passes until no file is left, shows the log of each pass and, after each pass, the progress per file:
Pass 1: 1 files left ... 20261117_111118-hamburg-60.zip: started 21/60Pass 2: 1 files left ... 20261117_111118-hamburg-60.zip: imported 60/60Success: Import finished after 2 passes, no file left.The command ends with an error if
- the licence is not active for the website,
- the import directory does not exist,
- without
--wait, another pass is currently running or its lock is still valid, in which case it exits with code 75; with--wait, the command waits until it has finished. With--force, the command takes over the lock immediately; a pass that is still running then ends itself after the step it is currently working on, - with
--wait, three passes in a row make no progress, for example because of a damaged file, - WP-ImmoMakler has given up on a file after a reported error. Such a file is only imported again once it is replaced,
- a pass aborts for a reason other than its run time being used up, for example because of a database error.
You can find the reason in the import log in the import directory. After each pass, the command states how many files and properties that pass imported, updated and deleted.
Show the import status
Section titled “Show the import status”wp immomakler import statuswp immomakler import status --format=jsonThe command shows the import directory, whether the automatic import is switched on, whether a pass is currently running and, for each file, the status, the number of imported properties and the last error. It changes nothing.
With --format=json or --format=yaml, the command outputs all of this information as one object, with the files under the key files. With --format=csv, it outputs only the list of files.
| Status | Meaning |
|---|---|
new |
The file has not been imported yet |
started |
The import of the file has begun and will be continued |
imported |
The file has been fully imported |
changed |
The file was replaced after its import and will be imported again |
ignored |
The file is not imported |
given up |
The import of the file failed with an error; it is only imported again once it is replaced |
The cache holds what WP-ImmoMakler can recreate at any time, for example PDF exposés and generated maps. The commands do the same as the cache row in the backend of your website (wp-admin) under WP-ImmoMakler → System info.
wp immomakler cache statuswp immomakler cache flushwp immomakler cache prune| Command | Meaning |
|---|---|
cache status |
Shows the directory, the size of the cache, the part of it the size limit applies to, and the configured size limit. --format as with license status. |
cache flush |
Empties the cache completely. The first request for a PDF exposé or a map takes longer afterwards because the file is recreated. If files are left over, the command ends with an error. |
cache prune |
Trims the cache to its size limit, deleting the oldest files first. WP-ImmoMakler otherwise does this once an hour. Without a size limit the command does nothing. The fonts of the PDF exposés and the address suggestions script do not count towards the limit and are always kept, so the cache as a whole can be larger than its limit. If the cache is still above the limit after trimming, the command ends with an error. |
If cache flush or cache prune do not delete everything they should, WP-CLI is usually running as a different user than the web server and is not allowed to delete its files. Run the command as that user then, for example with sudo -u www-data wp ….
Orphaned attachments
Section titled “Orphaned attachments”Orphaned attachments are images and documents of properties that no longer exist. WP-ImmoMakler deletes them in the background by itself; the command starts the cleanup immediately, like the Clean up now button under WP-ImmoMakler → System info.
wp immomakler attachments statuswp immomakler attachments cleanupattachments status shows how many orphaned attachments there are and how many of them can be deleted now. It changes nothing.
attachments cleanup goes through all attachments once. An orphaned attachment is not deleted immediately but first marked and removed only after a waiting period. After the first run the number can therefore be unchanged; the output states the time from which the marked attachments will be deleted. If an import is running or starts during the cleanup, the command ends with an error; run it again after the import.
Reset property data
Section titled “Reset property data”The command permanently deletes all properties and contact persons, including those in the trash, together with all WP-ImmoMakler attachments, and empties the wp-content/uploads/immomakler/ directory and the cache. It does the same as Reset property data in the backend of your website (wp-admin) under WP-ImmoMakler → System info in the Tools tab.
wp immomakler resetwp immomakler reset --yeswp immomakler reset --yes --keep-service-cachesThe command first states the website and the number of properties, contact persons and attachments, and then asks whether it should delete them. Only the answer y starts the deletion. --yes answers the question in advance and is meant for scripts.
Settings, licence, templates, categories, contact enquiries and the transfer files in the import directory are kept. Transfer files that were already fully imported still count as imported; import run does not import them again. A file whose import had only just begun, on the other hand, is read again from the start by the next import. While an import or another reset is running, the command ends with an error. After an abort, for example with Ctrl+C, the reset still counts as running for up to two minutes. After that, wp immomakler reset --resume continues it where it stopped, with the cache setting it was started with; it cannot be combined with --keep-service-caches. Without --resume the command starts from the beginning. If individual entries cannot be deleted, the command ends with an error; the log of the cleanup names them, and calling it again tries once more.
The command also deletes the cache of external services: map images, address suggestions of the radius search, preview images, the coordinates determined for addresses and responses of the AI provider. The next import requests them again; for services that charge per request, this may incur costs again. With --keep-service-caches this cache is kept, just as when you clear the checkbox Also delete the cache of external services in the backend.
Starter templates
Section titled “Starter templates”The starter templates are ready-made templates for the detail page, the property list and the list card that the setup wizard creates in your page builder. The command creates the same templates.
Install templates
Section titled “Install templates”wp immomakler starter-templates installwp immomakler starter-templates install --builder=elementorwp immomakler starter-templates install --target=single --dry-runThe command creates the templates and assigns them to all properties, references, projects, the property list and the reference list. Running it again does not create anything twice: it updates the templates that the command or the setup wizard created earlier to the state of the installed plugin version.
| Option | Meaning |
|---|---|
--builder=<builder> |
The page builder. Without the option, the command detects it itself. |
--target=<target> |
Which template: single (detail page), reference (reference), project (project), archive (property list), reference-list (reference list) or all (default). |
--dry-run |
Prints the content of the templates instead of saving it. |
These values exist for --builder:
| Value | Page builder |
|---|---|
avada |
Avada |
bricks |
Bricks |
divi4 |
Divi 4 |
divi5 |
Divi 5 |
elementor |
Elementor Pro |
enfold |
Enfold |
gutenberg |
Site editor of a block theme |
impreza |
Impreza |
wpbakery |
WPBakery Page Builder |
yootheme |
YOOtheme Pro |
Without specifying a page builder
Section titled “Without specifying a page builder”Without --builder, the command uses the website’s page builder and names it in the first line of the output:
Builder: elementor (detected; also available: gutenberg, choose with --builder)If several page builders are active, the same order applies as in the setup wizard:
- The page builder chosen in the setup wizard takes precedence.
- A page builder comes before the block theme it runs on: Elementor Pro before the site editor.
- With Impreza, the templates are created in its own template system, not as template pages of the bundled WPBakery Page Builder.
- With Divi, the version the website runs on decides between Divi 4 and Divi 5.
- A page builder in which the command cannot create templates is skipped, for example Elementor without Elementor Pro.
If the command finds no page builder in which it can create templates, it ends with an error and names the page builders found and the ones supported.
Remove templates
Section titled “Remove templates”wp immomakler starter-templates removewp immomakler starter-templates remove --builder=elementor --target=archiveThe command removes the starter templates and their assignment. --builder and --target apply as with install.
- Removed templates end up in the trash. YOOtheme Pro has no trash, so they are deactivated there.
- The command only removes templates that it or the setup wizard created. A template that already existed beforehand and was adopted is kept; the output names it.
- Your own templates and the properties are left untouched.
AI search PLUS
Section titled “AI search ”These commands show you what the AI search on your website makes of a search query. They are available when an AI connector is set up on the website.
Interpret a search query
Section titled “Interpret a search query”wp immomakler ai-search interpret "3-room flat up to 230,000 EUR in Hamburg Othmarschen"wp immomakler ai-search interpret --file=queries.txtThe command translates a search query into filters and shows the detected criteria, the address of the filtered property list and the summary that visitors see. With --file, you pass a text file with one search query per line; empty lines and lines starting with # are skipped.
Show the search criteria
Section titled “Show the search criteria”wp immomakler ai-search schemaThe command shows what the AI search on your website can filter by: the response schema built from the categories and value ranges of your properties. It sends nothing to the AI provider.
Example: set up a website by script
Section titled “Example: set up a website by script”This is how to set up a freshly installed WordPress website on which your page builder is already active.
-
Install and activate the plugin
Terminal window wp plugin install /path/to/immomakler-plus-50.zip --activate -
Activate the licence
Terminal window wp immomakler license activate "$LICENSE_KEY"Pass the licence key from an environment variable so that it does not appear in the script.
-
Put the OpenImmo file in the import directory
By default, the import directory is the
openimmofolder in the website’s root directory.Terminal window mkdir -p openimmocp /path/to/export.zip openimmo/ -
Import the properties
Terminal window wp immomakler import run --wait -
Create the starter templates
Terminal window wp immomakler starter-templates install
Every command ends with an exit code other than 0 on failure; import run ends with 75 if the import is currently locked, so that a script can try again later. With set -e, a shell script therefore stops at the point where something went wrong.