Support

Account

Home Forums Backend Issues (wp-admin) CSS throwing 404 if wp-plugin is a symlink

Solving

CSS throwing 404 if wp-plugin is a symlink

  • I am not sure why you are not using the WordPress plugin_dir_url() and instead you created your own helpers_get_dir(), but your function does not account for symlinks. I fixed your plugin for my WP site by replacing $this->settings[‘dir’] with plugin_dir_url(__FILE__) in your acf.php file.

    Also you should not use constants like WP_PLUGIN_DIR and WP_CONTENT_DIR in your plugin. These are there only for testing and should not be use on production plugins/themes.

    You should look into updating your plugin to use WP core functionally…

  • Hi @radi

    Thanks for the feedback. I use a custom url helper because ACF can be included in a theme or as a plugin. Therefore the standard plugin_dir_url function is not an option.

    Perhaps there is a better way, I am open to your ideas.

    Thanks
    E

  • Came across this issue today. A work around for anyone else that stumbles on this is to redefine WP_PLUGIN_DIR using realpath in wp-config.php

    define ('WP_PLUGIN_DIR', realpath(WP_CONTENT_DIR.'/plugins'));

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘CSS throwing 404 if wp-plugin is a symlink’ is closed to new replies.