WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Wrong bloginfo('wpurl') usage. (7 posts)

  1. jli
    Member
    Posted 2 years ago #

    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.

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    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,

  3. jli
    Member
    Posted 2 years ago #

    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 ;-)

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  5. jli
    Member
    Posted 2 years ago #

    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 ;-)

  6. jli
    Member
    Posted 2 years ago #

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

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    cheers esmi! saved me some code searching there :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic