# Snippets

### **Alle Blöcke aus dem System**

![](https://i.ibb.co/rc21kb6/getallblocks.png)

Hier werden alle Blöcke angezeigt, welche du bisher registriert hast sowie die Standardblöcke. Dies kannst du bequem über eine Zeile Code rauslesen.

```javascript
wp.data.select( 'core/blocks' ).getBlockTypes();
```

### Alle Blöcke auf der jetzigen Seite

Falls du auf der jetzigen Seite/Beitrag bist und nur von dieser Seite die verwendeten Blöcke benötigst, führe ganz einfach diese Zeile Code aus in der Console natürlich.

```javascript
wp.data.select('core/block-editor').getBlocks();
```

### Zeigt die aktuell Post Type an

Falls du im Backend auf der jetzigen Seite oder Beitrag die PostType herausfinden möchtest im Code und damit später Conditionals zu erstellen also IF() ... und so weiter, kannst du dieses Snippet verwenden:

```javascript
wp.data.select('core/editor').getCurrentPostType();
```

### Block deaktivieren

Falls du einen Block deaktivieren möchtest, dann kannst du dies so tun.&#x20;

```jsx
wp.domReady( function() {
    wp.blocks.unregisterBlockType( 'core/verse' );
} );
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://benjaminzekavica.gitbook.io/gutenberg/blocks/snippets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
