title: "wp scaffold block" post_status: publish comment_status: open taxonomy: category: - wp-cli-handbook post_tag: - Scaffold - Commands - Repos
wp scaffold block
为插件或主题生成用于注册 Gutenberg 区块的 PHP、JS 和 CSS 代码。
警告:wp scaffold block 已弃用。
生成区块的官方脚本是 @wordpress/create-block 包。
完整教程请参阅 创建区块教程。
OPTIONS
请参阅参数语法参考,以详细了解所使用的语法约定。
<slug> : 区块的内部名称。
[--title=<title>] : 区块的显示标题。
[--dashicon=<dashicon>] : 用于更轻松识别区块的 dashicon 图标。
[--category=<category>] : 用于帮助用户浏览和发现区块的分类名称。 --- 默认值: widgets 选项: - common - embed - formatting - layout - widgets ---
[--theme]
: 在活动主题目录中创建文件。使用 --theme=<theme> 指定一个主题,以将文件放置在该主题中。
[--plugin=<plugin>] : 在给定插件的目录中创建文件。
[--force] : 覆盖已存在的文件。
GLOBAL PARAMETERS
These global parameters have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
| Argument | Description |
|---|---|
--path=<path> |
Path to the WordPress files. |
--url=<url> |
Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
--ssh=[<scheme>:][<user>@]<host\|container>[:<port>][<path>] |
Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
--http=<http> |
Perform operation against a remote WordPress installation over HTTP. |
--user=<id\|login\|email> |
Set the WordPress user. |
--skip-plugins[=<plugins>] |
Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
--skip-themes[=<themes>] |
Skip loading all themes, or a comma-separated list of themes. |
--skip-packages |
Skip loading all installed packages. |
--require=<path> |
Load PHP file before running the command (may be used more than once). |
--exec=<php-code> |
Execute PHP code before running the command (may be used more than once). |
--context=<context> |
Load WordPress in a given context. |
--[no-]color |
Whether to colorize the output. |
--debug[=<group>] |
Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
--prompt[=<assoc>] |
Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
--quiet |
Suppress informational messages. |