• Resolved twomotifs

    (@twomotifs)


    I use an included file both with wordpress and mediawiki. I wanted to know whether there is a way to tell whether I am on a wordpress page so as to avoid function errors.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Maybe not the best way, but…
    if ( defined('WPINC') )
    {
    // wordpress
    }
    else
    {
    // not wordpress
    }

    Thread Starter twomotifs

    (@twomotifs)

    That’s great, tnx. Another one would be WP_USE_THEMES I guess.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    I considered WP_USE_THEMES, but the problem there is that some sorts of things don’t use the themes but are still “in WordPress”. Feeds, for example.

    WPINC gets defined early on in wp-settings, which is pretty much required, and WPINC doesn’t have any conditional cases in order to get defined.

    Thread Starter twomotifs

    (@twomotifs)

    You clearly know a lot more about it than I do. ?? Tnx for the info and help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how to test whether on a wordpress ‘page’ from an include?’ is closed to new replies.