wp-forge/custom-block-attributes
Composer 安装命令:
composer require wp-forge/custom-block-attributes
包简介
Allow users to add custom HTML attributes to blocks in the Block Editor.
README 文档
README
A WordPress plugin that allows users to add custom HTML attributes to any block in the WordPress Block Editor (Gutenberg).
Description
Custom Block Attributes extends the WordPress Block Editor by adding the ability to set custom HTML attributes on any block. This is particularly useful for developers and advanced users who need to add specific attributes for styling, JavaScript functionality, accessibility, or third-party integrations.
Features
- Add custom HTML attributes to any WordPress block
- Simple and intuitive user interface in the block inspector panel
- Easily add, edit, and remove custom attributes
- Attributes are saved with the block and rendered on the frontend
- Works with all core and custom blocks
Installation
Manual Installation
- Download the plugin zip file
- Log in to your WordPress admin panel and navigate to Plugins → Add New
- Click the "Upload Plugin" button at the top of the page
- Choose the downloaded zip file and click "Install Now"
- Activate the plugin through the 'Plugins' menu in WordPress
Using Composer
composer require wp-forge/custom-block-attributes
Usage
- Edit a post or page using the Block Editor
- Select any block you want to add custom attributes to
- In the block settings sidebar, scroll down to find the "Custom HTML Attributes" panel
- Add attribute keys and values as needed
- The attributes will be applied to the block's HTML output on the frontend
Example
If you want to add a custom data attribute to a paragraph block:
- Select the paragraph block
- Open the "Custom HTML Attributes" panel in the sidebar
- Enter "data-custom" as the attribute key
- Enter "value" as the attribute value
- Click "Add Attribute"
The resulting HTML on the frontend will be:
<p data-custom="value">Your paragraph content</p>
Requirements
- WordPress 6.7 or higher
- PHP 7.4 or higher
Frequently Asked Questions
Will this work with all blocks?
Yes, this plugin is designed to work with all WordPress blocks, including core blocks, theme blocks, and blocks from other plugins.
Can I add any HTML attribute?
Yes, you can add any valid HTML attribute. However, some attributes may be overridden by WordPress or the theme if they conflict with existing attributes.
Will this affect my site's performance?
The plugin is lightweight and only loads in the admin when editing posts or pages. It has minimal impact on frontend performance.
Changelog
1.0.1
- Fix bug where attributes were applied to all child elements as well
1.0.0
- Initial release
Credits
Developed by Micah Wood
License
This plugin is licensed under the GPL v2 or later.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
A copy of the license is included in the root of the plugin's directory. The file is named LICENSE.
wp-forge/custom-block-attributes 适用场景与选型建议
wp-forge/custom-block-attributes 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 973 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wp-forge/custom-block-attributes 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wp-forge/custom-block-attributes 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 973
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2025-03-16