Change WordPress user roles and capabilities Forums Bug Reports URE_WP_ADMIN_URL returns admin URL before filters are applied

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3373
    kodebyraaet
    Spectator

    Hi,

    I use a custom URL to the CMS and that causes problems for the User Role Editor plugin. I rewrite the admin URL by applying a filter to the ‘admin_url’-filter. User Role Editor ignores the filter, and I have pinpointed it down to the way you use DEFINE very early in your scripts (includes/define-constants.php) to define the admin URL, it seems to skip running filters on it first or something. If I replace all the usages of the URE_WP_ADMIN_URL constant with admin_url() it all works just fine.

    I don’t want to make changes in your files as they most likely will be overwritten and broken in a future update. Can you take a look at this?

    It’s easily reproducible by adding a test-filter in the functions.php file:

    
    function fix_admin_url($url, $path, $blog_id) {
        return str_replace('/wp-admin/', '/something/', $url);
    }
    
    add_filter('admin_url', 'fix_admin_url', 10, 3);
    

    This filter will not be applied to your plugins forms or ajax-urls.

    #3374
    kodebyraaet
    Spectator

    I solved this by adding my filter in the mu-plugins directory, it is then ran before the URE_WP_ADMIN_URL is defined. I guess that is a decent workaround, so no need to look into this unless you want to fix it anyway 😉

    #3375
    Vladimir
    Keymaster

    Hi,

    Thanks for letting me know that your issue was resolved.
    I will think, it would have sense to replace this constant with a direct admin_url() call through all code.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.