Putting your Gutenberg block on the WordPress Block Directory helps you reach more people and show off your work worldwide. Here’s how to start:
- Get Ready:
- Set up a code editor, like Visual Studio Code.
- Use Node.js (Active LTS version) for tools such as
wp-scriptsandcreate-block. - Make a local WordPress site with tools like
wp-envor others like Local or DevKinsta.
- Know the Rules:
- Follow Plugin Directory, Community, and Forum rules.
- Make sure your plugin fits the GPLv2 license.
- Keep up with security and code quality rules.
- Make Your Block:
- Use
@wordpress/create-blockfor an easy start. - Stick to one block per plugin. Add a clear
block.jsonand keep server-side code light.
- Use
- Test and Check:
- Test your block on different themes and devices.
- Use the Block Plugin Checker to meet WordPress needs.
- Send Your Plugin:
- Pack your plugin in a ZIP file and send it to the WordPress Plugin Directory.
- Quickly handle any feedback from reviewers.
- List Your Block:
- Once it’s okay, make sure your block is clearly useful.
- Use good descriptions and keywords to help people find it.
Building Your First WordPress Gutenberg Block: Beginner’s Guide!
Get Ready to Start
Before you jump into making blocks in WordPress, there are some things you must set up and know well. Here’s what’s important before you start creating Gutenberg blocks.
Set Up Your WordPress Area
To make blocks, you need three main things: a code editor, Node.js tools, and a local WordPress setup [1].
- Pick a Code Editor: Visual Studio Code is a top choice. It’s free, built with open code, and has many plugins to make your work better [1].
- Get Node.js and Tools: Node.js is key for using tools like
wp-scripts,wp-env, andcreate-block[1]. Use a version manager likenvmto switch Node.js versions easily, as different projects may need different ones. For making blocks, use the Active LTS (Long Term Support) version [1][4]. - Make a Local WordPress Setup: It’s key to test your blocks where it’s safe. The WordPress Block Editor Handbook says to use
wp-env, a tool made by the WordPress team for Gutenberg work [1][2][4].
"wp-env simplifies local WordPress setups with a single command", says Noah Alen [2].
If wp-env doesn’t fit your setup, you might like DevKinsta, Local, XAMPP, MAMP, or Varying Vagrant Vagrants [1][2][4]. For fast tests, try @wp-playground/cli. It’s simple and new and great for testing WordPress stuff [1].
Once all is set, make sure your plugin follows WordPress rules.
Learn WordPress Plugin Rules
Before you send in your plugin, learn the WordPress rules. You must follow the Plugin Directory Rules, Community Rules, and Forums Rules – no changes allowed [5].
Keep things safe. WordPress has tough rules for safety, and you must make sure your blocks are safe for all [5]. Any bugs in your plugin might affect many sites.
Your plugin needs to fit the GNU General Public License (GPLv2 or later), matching WordPress’s free-use idea [5]. Also, keep your contact info on WordPress.org up-to-date. This helps WordPress get in touch if there are problems or questions [5].
In the end, check that all your files meet the rules and license needs. You must answer for your plugin’s actions and following the rules [5].
Get Block Making Tools
The best start to making blocks is with @wordpress/create-block. This official tool makes all you need – PHP, JavaScript, CSS, and a new setup for your block type [1][2][4].
According to WordPress.org, "Create Block is an officially supported way to create blocks for registering a block for a WordPress plugin. It offers a modern build setup with no configuration. It generates PHP, JS, CSS code, and everything else you need to start the project." [2]
Once you make your block, go to its folder and run npm start. This will let it build again every time you change something [2][4]. To get it ready for others, run npm run build to make the end version [2].
You’ll use wp-scripts too, which is a set of tools just for making things in WordPress. For most new blocks, this is all you need to build them [2].
Make sure you know the basics of JavaScript first. You need to get JavaScript, Node.js, React, and Redux to make good Gutenberg blocks [2][3]. Also, knowing HTML, CSS, and how to make WordPress plugins is key [2][3][4]. Node.js lets you use JavaScript outside the web, and npm helps you handle parts and scripts. With npx, you can use npm stuff without putting them on your system first – both npm and npx are in Node.js [1][2].
How to Make Your Gutenberg Block Go Live
Once you’ve made sure your Gutenberg block works well, it’s time to get it out there for others. This means taking a few key steps to make sure all is set right.
Set Up Your Block
First, use the @wordpress/create-block tool to build your block’s base. Open your command line tool, go to your WordPress plugins area, and run the tool to create your block.
This tool will ask for things like the block name, description, and category. Pick a name that shows what your block does. For the category, use a common one from WordPress, like "text", "media", "design", "widgets", or "theme."
When you run the @wordpress/create-block tool, it makes a folder that has key files like:
block.json(the main info file)index.js(sets up the block)edit.js(the editor part)save.js(the part that shows on your site)
The block.json file is very important. Make sure the description field tells what your block does, and add keywords to help people find it.
Make and Check Your Block
Work on your block to make it work well and be easy to use. Test it with different themes, devices, and ways users might try to use it to make sure it fits well and is safe.
Be very careful with making it easy to use for all by using the right HTML bits and labels for screen readers and keyboard use. Also, follow WordPress rules in your code by using built-in functions and hooks. This makes your block work better and be safer.
When your block is ready, use the Block Plugin Checker to make sure it meets the WordPress rules.
Look Over Your Block Plugin
After making and testing, check your plugin to see it fits all WordPress musts. The Block Plugin Checker helps with this. It will look at your block.json file, make sure the block is set up right, and see that it sticks to WordPress rules.
Things the Block Plugin Checker might flag include:
- Missing or wrong info in
block.json - Wrong use of text domain
- Security risks
Your plugin should do one thing and have just one block. The Block Directory won’t take plugins with more. Also, the plugin must work on its own, meaning it shouldn’t need outside services or paid parts.
Send to WordPress Plugin Directory
Before your block shows in the Block Directory, it has to be okayed for the WordPress Plugin Directory. If you’re not signed up on WordPress.org yet, do that, then go to the plugin send-in page.
Turn in your plugin as a ZIP file. The WordPress staff will look it over, which can take from a few days to some weeks. They’ll check for security, code quality, and match with WordPress rules.
If they ask for changes or have tips, fix these fast. Common tips include better security, tidy up your code, or make clearer what your plugin does.
When your plugin gets the OK, you can enter its SVN store. Use SVN to put up your plugin files. Make sure to tag your first send out right. Don’t miss adding a full readme.txt with how to set it up and a log of changes.
Put Your Block in the Block List
Once your plugin is out, you go to the next step: show your block in the WordPress tool by the Block List. This step needs more than the usual Plugin List.
Your block must give clear good to users. It should make their writing better, not just work as a tool or for managing. Title, words to describe it, and key words must show off its good points from the view of the user. Think how your block helps users hit their targets.
The review of the Block List keeps the user feel in mind. People checking it will look at how easy your block is to use, if it adds real worth, and how well it fits with the WordPress tool.
When it passes, your block will show up in the Block List within the WordPress tool. Users will find and add it straight from the block adder, making it more seen than in the usual Plugin List.
sbb-itb-77ae9a4
Steps to Win
To get your Gutenberg block in the Block Directory, you need more than just good code. Building from earlier points about setup and plugin rules, here are some key tips for getting your block approved.
Follow WordPress Rules
Your plugin should only have one block [7]. This rule is firm and makes things clear and simple for users.
Be sure to use a top-level block.json file [6][7]. Keep this file in the main folder of your plugin so review tools can check it easily.
Use as little server-side code as possible. The Block Directory likes blocks that work mostly in the editor, and not on complex back-end systems [7]. Also, your plugin shouldn’t add things outside the post editor [7].
Don’t skip making a clear and short readme.txt file. It should have setup steps, info on what your block does, and a list of changes by version [7]. Keeping up with WordPress guides will help you polish these parts.
Boost Your Skills with Help
After making sure your block fits the rules, keep getting better at what you do. WP Winners has deep tutorials and guides from basic block setup to skilled tips for the Block Directory. These help build up the core steps to make useful blocks.
Also, WP Winners sends out a newsletter about changes to WordPress rules. This keeps you on top of changes, helping you stay right and steer clear of mistakes.
End Talk
To get your Gutenberg block out on the WordPress Block Directory, you need to do a lot of prep work. Start by setting up your work area and learn the rules for WordPress plugin creation. Then, you can make your block, test it well, and send it to both the Plugin Directory and the Block Directory.
Make your plugin simple – it should have just one block, a main block.json file, small server-side code, and a clear readme.txt. Your readme.txt must have setup steps and all version changes to help users.
Doing all these steps makes sure your block works well and is useful to the WordPress folks. Your block might be a simple style tool or something with many cool parts. A good block can really help a lot of people who run websites.
Don’t skip testing your block with different themes and setups to hit WordPress’s top quality marks. This hard work helps your block get approved.
For more tips and news on making WordPress stuff, spots like WP Winners have lessons, help, and news to keep you up to date. With this advice, you’re set to make and send in a block that makes WordPress better.
Ready to begin? Go ahead and make a block that brings real value to website owners everywhere.
FAQs
How do I check if my Gutenberg block is safe and meets WordPress’s rules before I send it in?
To be sure your Gutenberg block follows WordPress’s safety and coding rules, here are key steps to take:
- Focus on Safety: Always clean user inputs, check data well, and use nonces to fight off dangers like XSS (Cross-Site Scripting) and CSRF (Cross-Site Request Forgery). These steps help make your block safe.
- Keep Code Good: Follow WordPress’s set coding standards, write clear and simple code, and make sure your block works well with the newest Gutenberg APIs.
It’s key to often test your block for how fast it runs, how easy it is to use, and if it works with other parts. This makes sure a good user feel and keeps your block right for WordPress’s needs.

