lps init
lps init creates a loopress.json file in the current directory. Run it once at the root of each project you want to manage with Loopress.
lps initThe command is interactive: it prompts you for each field and writes the result to loopress.json.
Prompts
Section titled “Prompts”| Prompt | Description |
|---|---|
| WordPress project | Select a project you have already configured with lps project config, or enter a project ID manually. When no project exists yet, lps init offers to run lps project config right away and continues with the project you create. |
| Root directory | Base directory for the project. All other paths are resolved relative to it. Defaults to .. |
| Snippets directory | Directory where snippet files are written and read. Relative to root. Defaults to snippets. |
| Other features | Optional multi-select for ACF, SEO, Forms and custom API routes. Only the features you pick get their directory written to loopress.json (defaults: acf, seo, forms, api). |
| Snippet provider | The WordPress plugin used to manage snippets: Code Snippets, WPCode, or none if it’s already installed. When you pick one, it’s added to plugins. |
The final summary lists everything that was configured and the next useful command.
Generated file
Section titled “Generated file”{ "projectId": "my-site", "rootDir": ".", "snippetsDir": "snippets", "plugins": { "code-snippets": "latest" }}Commit this file to Git. It ties the repository to a specific Loopress project and controls where lps snippet pull writes files.
Fields reference
Section titled “Fields reference”| Field | Default | Description |
|---|---|---|
projectId |
none | Name of the project configured via lps project config. Overrides the globally active project for all commands run in this directory. |
rootDir |
. |
Base directory. All relative paths in loopress.json are resolved from here. |
snippetsDir |
snippets |
Directory for snippet files, relative to rootDir. |
acfDir |
acf |
Directory for ACF field groups, post types, taxonomies and options pages, relative to rootDir. Used by lps acf pull/push. |
seoDir |
seo |
Directory for SEO settings, post meta and redirects, relative to rootDir. Used by lps seo pull/push. |
formDir |
forms |
Directory for form files, relative to rootDir. Used by lps form pull/push. |
apiDir |
api |
Directory for custom API route files, relative to rootDir. Used by lps api pull/push. |
plugins |
none | WordPress.org plugins managed by Loopress (slugs). Populated by the snippet provider prompt in lps init, and by lps plugin pull and lps plugin add. |
If loopress.json already exists
Section titled “If loopress.json already exists”lps init will ask whether to overwrite the existing file. Choose No to keep the current config and abort.
Next steps
Section titled “Next steps”# Pull your existing snippets from WordPresslps snippet pull
# Snapshot your installed pluginslps plugin pull
# Commit everythinggit add loopress.json snippets/git commit -m "chore: add loopress config"