Support » Plugins and Hacks » Hacks » Is functions.php called before plugins?

  • Resolved richarduk

    (@richarduk)


    I’m trying to pass a variable to a plugin. The variable is the url of the referring page. I’m currently putting the bit of code to get this in functions.php

    Is functions.php called befoAre plugins?

Viewing 9 replies - 1 through 9 (of 9 total)
  • No, the theme’s functions.php file is called well after plugins are loaded.

    Thanks.

    That explains it.

    Is there a page I can add my code snippet to that’s called before the plugins? How about config.php, as that doesn’t get updated?

    If you just need the url of the referring page, you could grab that anywhere using $_SERVER[‘HTTP_REFERER’], there shouldn’t be any need to run other code elsewhere.

    I want to pass it to the plugin, that’s the problem. I’m guessing that all the theme files are called well after the plugins?

    The $_SERVER[‘HTTP_REFERER’] is a superglobal. You can get it in plugins directly. You don’t need any theme code to do that.

    just as curiosity: what’s the exact output of $_SERVER[‘HTTP_REFERER’]? I need the referrer’s URL to lack the ‘http://wwww.’, how could I do that?

    @hospedagem: the exact output is the referring page’s url 😉

    So the only way you can be sure there isn’t the www is to do a str_replace to remove any leading www.

    Thanks, Otto. In my case it didn’t help, but it’s useful to know.

    Can we modify, add, or change params in plugins through functions.php ?

    I have a plugin and i wand to change the title of one field in the plugin. But every time i update the plugin i loose the changes.

    Is there a way to modify plugin and to save the changes for future updates of these plugins?

    Thanks friends

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Is functions.php called before plugins?’ is closed to new replies.