admin管理员组

文章数量:1323562

This question already has an answer here: Where on Github, or elsewhere, can I find the code for core-blocks? (1 answer) Closed 4 years ago.

I apologize if this has been answered already. I've spent several hours searching through the WordPress directories and documentation, and I haven't been able to find the code for the default Gutenberg blocks. Could anyone point me in the right direction?

To clarify, I am specifically wondering where in the directory tree of a WordPress installation the blocks are defined.

This question already has an answer here: Where on Github, or elsewhere, can I find the code for core-blocks? (1 answer) Closed 4 years ago.

I apologize if this has been answered already. I've spent several hours searching through the WordPress directories and documentation, and I haven't been able to find the code for the default Gutenberg blocks. Could anyone point me in the right direction?

To clarify, I am specifically wondering where in the directory tree of a WordPress installation the blocks are defined.

Share Improve this question edited Sep 13, 2020 at 2:13 blendenzo asked Sep 10, 2020 at 1:10 blendenzoblendenzo 1034 bronze badges 1
  • @JacobPeattie Partly. It looks like the answer there links to the most recent "bleeding edge" source code on Github. That is very helpful, but I'm specifically interested in seeing the source for the block versions in my current WordPress installation, so I would like to know where the locally installed blocks are defined. I will clarify my question with that extra detail. – blendenzo Commented Sep 10, 2020 at 15:02
Add a comment  | 

1 Answer 1

Reset to default 3

If your end goal is to have a better understanding of how blocks work, I would encourage to install the gutenberg plugin instead.

The block code within the WordPress installation itself is not intended to be read by end users nor directly modified. It's minified to save space.

To answer your question, the code is stored in a couple places:

  • wp-includes/js/dist/block-library.js
  • wp-includes/blocks/

If you wish to modify a core block, like a block style variation where you can modify the CSS of a particular block, do not modify those files, it's recommended to place your code in a custom plugin that you would make. (and depending how much you want to modify it, you may want to just create your own block).

本文标签: Where in a Wordpress installation is the code for the default Gutenberg blocks located