Upgrading from 1.x to 2.x
Changes
Changes to the header block
The header block has been updated as part of version 2. This improves the flexibility of the header block and allows for more customisation. If you are using the header block on your site, you will need to update any use statements from Creode_Blocks\Header_Block
to Creode_Blocks\Legacy_Header_Block
.
Removal of the category()
method
The block class has been updated in version 1 to remove the need for a category()
method in blocks. This is now controlled by a filter that is applied in your theme. This change can be actioned manually for every block or you can use the Rector ruleset to automatically make your blocks compatible with the new version.
Removal of the $instance
class property
The $instance
class property has been removed from the block class as it is no longer required to function due to some internal changes to the block class.
Rector ruleset
You can find the Rector setup instructions for this plugin here.
For version 2.x of the block plugin, you can use the following command to upgrade your blocks, take specific note of the {theme-name}
placeholder which should be replaced with the name of your WordPress theme:
vendor/bin/rector process wp-content/themes/{theme-name} --config=vendor/creode/wordpress-blocks-rector/config/blocks-2-0.php