Skip to content
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

Admin assets integration not respecting custom WordPress directory #844

Closed
felixarntz opened this issue Sep 21, 2022 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@felixarntz
Copy link
Collaborator

felixarntz commented Sep 21, 2022

On my site where I'm using WordPress in a wp subdirectory (i.e. my WP Admin is not under /wp-admin, but rather /wp/wp-admin), I consistently get JS errors like when browsing my WP Admin:

Uncaught (in promise) bad-precaching-response: bad-precaching-response :: [{"url":".../wp-admin/images/wheel.png","status":404}]

It's different WordPress core images depending which admin screen I visit, but the underlying problem is that the PWA plugin does not consider the correct admin URL. I believe this problem happens due to

'url' => strstr( $filename, '/' . $folder ),
, where the code assumes the wp-admin folder is in the root of the domain.

A possible solution would be to rely on the site_url() function to get the right location: If WordPress is in a subdirectory, the site URL would include that. So if it does, that directory should be added to the actual folder as a prefix.

(FWIW since that method is also used for image files in wp-includes, the bug is probably present there as well. The same approach I suggested above should fix that problem too.)

@felixarntz felixarntz added the bug Something isn't working label Sep 21, 2022
@westonruter
Copy link
Collaborator

The integrations are deprecated per #403 so probably best to just turn that off.

@felixarntz
Copy link
Collaborator Author

Oh... Fair point 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants