#59175 closed defect (bug) (fixed)
register_block_type is not working with symbolic links
Reported by: | antonlukin | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 6.5 | 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
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 (12)
This ticket was mentioned in PR #5460 on WordPress/wordpress-develop by @spacedmonkey.
11 months ago
#2
- Keywords has-patch added
Trac ticket: https://core.trac.wordpress.org/ticket/59175
#3
@
11 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.
#7
@
7 months ago
I encountered the same problem today and arrived at the same place (and solution). It would be very useful to support symbolic links for themes. Thanks for this PR.
#9
@
7 months ago
I reproduced the issue and the patch fixes it.
I'm gonna commit it so it still have time to be tested during beta cycle.
By the way I'm wondering about directly including realpath()
in wp_normalize_path()
to avoid those issues in the future? (but that's for another ticket).
#10
@
7 months ago
- Owner set to audrasjb
- Resolution set to fixed
- Status changed from new to closed
In 57675:
@audrasjb commented on PR #5460:
7 months ago
#11
committed in https://core.trac.wordpress.org/changeset/57675
@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.