Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungRefreshed repository pull requests page generally available(22.09.2026 um 03:25 Uhr)
Sichere ProgrammierungThe Joy of Learning the Basics Again(22.09.2026 um 03:28 Uhr)
Sichere ProgrammierungZero-Code OpenTelemetry Tracing for Dagster(22.09.2026 um 03:39 Uhr)
Linux Tipps & Hardening`prime-all`(22.09.2026 um 02:28 Uhr)
IT Security Toolsopensoho v0.15.2(22.09.2026 um 03:33 Uhr)
IT Security NachrichtenUS Proposes AI Incident Alert System in Talks With China, Bessent Says(22.09.2026 um 04:01 Uhr)
Sichere ProgrammierungRefreshed repository pull requests page generally available(22.09.2026 um 03:25 Uhr)
Sichere ProgrammierungThe Joy of Learning the Basics Again(22.09.2026 um 03:28 Uhr)
Sichere ProgrammierungZero-Code OpenTelemetry Tracing for Dagster(22.09.2026 um 03:39 Uhr)
Linux Tipps & Hardening`prime-all`(22.09.2026 um 02:28 Uhr)
IT Security Toolsopensoho v0.15.2(22.09.2026 um 03:33 Uhr)
IT Security NachrichtenUS Proposes AI Incident Alert System in Talks With China, Bessent Says(22.09.2026 um 04:01 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

How to Create a Custom Gutenberg Blocks Plugin in WordPress (wp-custom-blocks)

Building custom Gutenberg blocks is one of the most valuable skills for modern WordPress developers. In this article, we’ll create a real plugin from scratch called wp-custom-blocks. The Gutenberg editor has transformed how we build c…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Building custom Gutenberg blocks is one of the most valuable skills for modern WordPress developers. In this article, we’ll create a real plugin from scratch called wp-custom-blocks.



The Gutenberg editor has transformed how we build content in WordPress. Instead of relying on shortcodes or page builders, we can now create reusable, dynamic blocks using modern JavaScript (React) and WordPress APIs.



In this tutorial, you’ll learn how to create your own custom block plugin and understand the core concepts behind it.



Prerequisites:



Before starting, make sure you have:




  • WordPress installed locally

  • Node.js and npm installed

  • Basic knowledge of JavaScript and React

  • A code editor (VS Code recommended)



Step 1: Create the Plugin



Open your terminal and run:



npx @wordpress/create-block wp-custom-blocks



This command scaffolds a complete plugin with build tools, configuration, and a sample block.



Step 2: Navigate to the Project



cd wp-custom-blocks

npm install

npm start



Now your development environment is running and watching for changes.



Step 3: Understand the Project Structure



The generated project includes:



src/

index.js

build/

block.json

package.json





  • src/ → source code (React)


  • build/ → compiled files


  • block.json → block configuration



Step 4: Create a Hero Block



Let’s create a custom block with editable content.



Create a folder:



src/blocks/hero/



Register the Block



js

import { registerBlockType } from '@wordpress/blocks';

import Edit from './edit';

import Save from './save';



registerBlockType('wpcb/hero', {

title: 'Hero Block',

category: 'design',



attributes: {

title: { type: 'string', default: 'Hero Title' },

text: { type: 'string', default: 'Hero description...' },

buttonText: { type: 'string', default: 'Click here' },

},



edit: Edit,

save: Save,

});



Step 5: Block Editor (Edit)



js

import { RichText } from '@wordpress/block-editor';



export default function Edit({ attributes, setAttributes }) {

return (





tagName="h1"

value={attributes.title}

onChange={(value) => setAttributes({ title: value })}

/>
  <RichText
tagName="p"
value={attributes.text}
onChange={(value) => setAttributes({ text: value })}
/>

<RichText
tagName="button"
value={attributes.buttonText}
onChange={(value) =>
setAttributes({ buttonText: value })
}
/>
</div>

);

}



Step 6: Save Component



js

import { RichText } from '@wordpress/block-editor';



export default function Save({ attributes }) {

return (










  <p>
<RichText.Content value={attributes.text} />
</p>

<button>
<RichText.Content value={attributes.buttonText} />
</button>
</div>

);

}



Step 7: Import the Block



In src/index.js:



js

import './blocks/hero';



Step 8: Test in WordPress




  1. Move the plugin folder to:
    wp-content/plugins/

  2. Activate the plugin

  3. Open the block editor

  4. Search for Hero Block



Creating custom Gutenberg blocks is a powerful way to build modern WordPress experiences. With tools like @wordpress/create-block, the setup is easier than ever.



If you're serious about WordPress development, mastering block development is a must-have skill.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to Create a Custom Gutenberg Blocks Plugin in WordPress (wp-custom-blocks)

Thematisch verwandte Begriffe: Create, Custom, Gutenberg, Blocks · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-49449 | Joplin is an open source note-taking and to-do application that organise…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick