WordPress.org

Ready to get started?Download WordPress

Forums

How to include() a file from other dir (1 post)

  1. gameblogs
    Member
    Posted 3 years ago #

    Hi, folks.

    I need to include a file from another plugin into my new plugin, but I just can't figure out how to indicate the paths correctly.

    My new file is in /plugins/new_plugin/new_plugin.php and I want to include a file that lies in /plugins/old_plugin/old_plugin.php

    I just need to
    include '/old_plugin/old_plugin.php';

    I've used the $_SERVER, WP_PLUGINS_DIR, ABS_PATH, and every single suggestion I've found in the webs.

    Some of them work just when viewing the plugin admin page, others work only when viewing the blog homepage, some do not work at all, but none work for the plugin page AND the homepage.

    At the home page I receive a PHP message stating the files cannot be found, or the page just does not render.

    What is the correct way to include a file that lies in another dir?

    Thanks a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic