Make WordPress Core

Opened 4 months ago

Last modified 2 months ago

#59175 new defect (bug)

register_block_type is not working with symbolic links

Reported by: antonlukin's profile antonlukin Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch
Focuses: Cc:

Description

I try to register new block inside functions.php of my theme with register_block_type( DIR . '/build/speech' ); function.
block.json is located inside './build/speech' directory.

The block registered correctly, but files editorScript and editorStyle can't enqueue because of the symlinks problem.

$is_theme_block variable set to false while
$style_path_norm points to /srv/http/kedr.media/theme/public/blocks/build/help/index.css
$template_path_norm points to /srv/http/kedr.media/wordpress/wp-content/themes/kedr

https://github.com/WordPress/WordPress/blob/106404bcbd2e8c19947b64691dd2dbadf0f02a47/wp-includes/blocks.php#L272

My theme is physically located on /srv/http/kedr.media/theme/public/ path, but WordPress core on /srv/http/kedr.media/wordpress/

This doesn't seem to be the best way to check if a block is part of a theme.

Change History (6)

#1 @spacedmonkey
2 months ago

@antonlukin There are been changes to the block registration process in WP 6.4. It is possible that you could test the latest beta to see if that fixes the issue.

This ticket was mentioned in PR #5460 on WordPress/wordpress-develop by @spacedmonkey.


2 months ago
#2

  • Keywords has-patch added

#3 @spacedmonkey
2 months ago

Pinging @audrasjb, as this is an area that they have looked at in the past. There is a draft PR with a fix.

#4 @antonlukin
2 months ago

I apologize for the delay, I'll try to check today with the latest patch

#5 @antonlukin
2 months ago

@spacedmonkey checked on 6.4. It works, thanks!

#6 @spacedmonkey
2 months ago

I believe it too late for 6.4, but maybe 6.4.1.

Note: See TracTickets for help on using tickets.