Skip to content

Instantly share code, notes, and snippets.

@cemaleker
Created December 23, 2017 17:29
Show Gist options
  • Save cemaleker/fcfd7822152bcb15a809e4b31d6d0264 to your computer and use it in GitHub Desktop.
Save cemaleker/fcfd7822152bcb15a809e4b31d6d0264 to your computer and use it in GitHub Desktop.
Fixes symlink resolution on redux options of embedded redux framework in neighborhood wordpress theme.
<?php
function __rd_dirname($path) {
$path = dirname($path);
return __rd_resolve_real($path);
}
function __rd_resolve_real($path) {
return realpath(is_link($path) ? readlink($path) : $path);
}
// Windows-proof constants: replace backward by forward slashes - thanks to: https://github.com/peterbouwmeester
$_dir = trailingslashit( str_replace( '\\', '/', __rd_dirname( __FILE__ ) ) );
$wp_content_dir = trailingslashit( str_replace( '\\', '/', __rd_resolve_real(WP_CONTENT_DIR) ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment