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

Broken asset URL generation when WP_PLUGIN_DIR not in ABSPATH #178

Open
denic opened this issue Oct 6, 2017 · 3 comments · May be fixed by #181
Open

Broken asset URL generation when WP_PLUGIN_DIR not in ABSPATH #178

denic opened this issue Oct 6, 2017 · 3 comments · May be fixed by #181

Comments

@denic
Copy link

denic commented Oct 6, 2017

I encountered a problem with my WP installation where I separated the WP core and the wp-content folder into different locations within the filesystem, eg.:

  • ABSPATH: /var/www/myblog/public/wp/
  • WP_CONTENT_DIR: /var/www/myblog/public/wp-content/

In this case the code will produce a broken URL like http://foo.bar-content/plugins/...

I solved it by using the WP_PLUGIN_DIR instead of ABSPATH:

if ( 0 === strpos( $module_dir, $plugin_dir ) ) {
    $rel_path = wp_normalize_path( str_replace( WP_PLUGIN_DIR, '', $module_dir));
    $url      = WP_PLUGIN_URL . $rel_path;
} else ...

Thanks and have a nice weekend!
Dennis

@denic
Copy link
Author

denic commented Nov 7, 2017

Anyone?

@zorca
Copy link

zorca commented Sep 20, 2018

RIP

@DimaMinka
Copy link

any news? Bro?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants