• Resolved Steve

    (@slescure)


    I’m modifying an old plugin that has the following line (below). I commented it out, and the plugin still seems to function. I’m just wondering if there’s a good reason this code should exist? Any thoughts? I would think get_option would always exist for a WordPress site…..

    if( !function_exists(‘get_option’) )
    {
    require_once(‘../../../wp-config.php’);
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • It depends on how the code is called. Sometimes you might not want to load everything, so you can be a bit more selective by adding things manually. This is mainly used for some things like external CRON jobs that don’t need the entire WordPress system loaded. It’s really just a check to make sure that the function is available if it’s not. There’s not going to be any noticeable overheard from this, so I’d leave it in – just in case!

    Thread Starter Steve

    (@slescure)

    thanks that was a big help!!

    steve

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘if function_exists’ is closed to new replies.