Jetpack/Sharedaddy appears broken with custom WP_CONTENT_URL

  • Author
    Posts
  • #711571

    alexrudy
    Member

    I’ve changed my WP_CONTENT_URL. After doing this, most things work fine (site is up and running), but Sharedaddy seems to incorrectly set its own plugin URL using plugin_dir_url(__FILE__) which returns the WP_PLUGIN_URL concatenated with the full (absolute) path to the file. This causes many sharedaddy features to not work. I thought that to get the URL, sharedaddy should strip the absolute file path (i.e. WP_PLUGIN_DIR) from the full __FILE__ path, then append WP_PLUGIN_URL to the front. However, instead I get a very messy path (like http://example.com/wp-content/var/www/wp-content/plugins/jetpack/modules/sharedaddy/) Is this supposed to happen?

    I am using jetpack 1.1.3 with sharedaddy 0.2.12
    Blog url: http://alexrudy.org/

    #711772

    mdawaffe
    Staff

    Is your WP_PLUGIN_DIR a symlink? Or is Jetpack installed under a symlink? If so, it won’t work. Many WordPress plugins will break in such a configuration since PHP’s __FILE__ resolves symlinks.

    See http://php.net/manual/en/language.constants.predefined.php

    #711925

    alexrudy
    Member

    Thank you. I thought it wasn’t symlinked, but my host does some tricky stuff with hard links and virtual paths, and these were being resolved by PHP but not by my troubleshooting.

    On a related note, is it a bad idea to set WP_CONTENT_DIR based on the resolution of __FILE__ (i.e. I’m confident I know where WP_CONTENT_DIR is relative to wp-config.php) so that I don’t have to worry about a possibly changing full path?

    Thanks!

    #711927

    mdawaffe
    Staff

    If things change on your host, there are problems with either choice, depending on the change.

    I’m in the “whatever works” camp, so… whatever works :)

    Setting WP_CONTENT_DIR based on __FILE__ makes sense to me.

The topic ‘Jetpack/Sharedaddy appears broken with custom WP_CONTENT_URL’ is closed to new replies.