Support » Plugin: Events Manager » Wrong bloginfo('wpurl') usage.

  • Resolved jli

    (@jli)


    Hello there,

    I just encountered some compatibility issue with a theme (http://www.rootstheme.com/).

    Roots rewrites the output of bloginfo(‘wpurl’) to be relative instead of absolute. Which means in most cases it simply returns ‘/’.

    In a few of your files you’re doing something like this:

    <?php bloginfo('wpurl'); ?>/wp-admin/...'

    The problem is that the url is then //wp-admin/… which isn’t interpreted as relative to the root of the website but is wp-admin was the domain itself.

    Solution: remove the leading ‘/’ in ‘/wp-admin/’

    I quickly fixed that on my local by grepin for ?>.’/wp-admin and then search replacing but I don’t think it’s enough.

    Contact me if you want a patch or something 😉

    Bests,
    John.

Viewing 6 replies - 1 through 6 (of 6 total)
  • esmi

    (@esmi)

    Forum Moderator

    Roots rewrites the output of bloginfo(‘wpurl’) to be relative instead of absolute.

    I’d argue that this is a theme issue – not a plugin one. The theme should not be rewriting any WP options other than its own,

    I expected that argument. And I have to admit I first thought that way too.
    But cleaning wordpress url is one of the main roots feature. So this is completely legit to affect global wp options.

    Next I thought of bloginfo(‘wpurl’)’s original behavior which is to output ‘http://whatever.com/’.

    The trailing slash is present – having double slashes in an url is not what I’d call best practice – so it lead me to the conclusion that the problem here is the leading slash in the plugin’s code and not the theme’s behavior.

    Thats why my bug report is here and not on rootstheme 😉

    esmi

    (@esmi)

    Forum Moderator

    But cleaning wordpress url is one of the main roots feature.

    It’s not “cleaning the url”. There’s nothing to clean in the first place. WordPress currently requires an absolute url. End of story. If the theme doesn’t want to use absolute urls, it must create its own relative url variable or function and use that. Themes should never re-write global options.

    I just doubled checked and It seems I’m wrong.
    There is not trailing slash output in bloginfo(‘wpurl’) – so the plugin’s code is perfectly ok.

    Going to check what can be made on roots’s side to fix this.

    Closing the ticket 😉

    Esmi: You made your point here. I’m going to see what can be done about this on roots side to make things better.

    Plugin Author Marcus

    (@netweblogic)

    NetWebLogic Support

    cheers esmi! saved me some code searching there 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Wrong bloginfo('wpurl') usage.’ is closed to new replies.