New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp scaffold block using --theme outputs the wrong code? #127

JakeImhoff opened this Issue Feb 19, 2018 · 1 comment


2 participants

JakeImhoff commented Feb 19, 2018


Today I tried using scaffold to create a block for gutenberg, I was using the --theme option. What me and my colleague found out is that the wp cli still implements plugin_url instead of something for the theme, and we have the following fix for it;

In code of the block e.g. 'blocks/my-custom-block.php'
Instead of:
$dir = dirname( __FILE__ );
$dir = get_template_directory() . '/blocks';

And instead of:
plugins_url( $block_js, __FILE__ ),
get_template_directory_uri() . "/blocks/$block_js",

The only thing you have to do next is go to your functions.php in the theme and paste this:
require( get_template_directory() . '/blocks/my-custom-block.php' );

I hope this helps some people out!


This comment has been minimized.


danielbachhuber commented Feb 21, 2018

Thanks for the report, @JakeImhoff. This is a bug, in fact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment