I have a child theme folder called themes/child-theme and inside I have a file dashboard_payments.php. Under the child theme folder I'm creating a new folder called gateway and inside there's a config.php.

So, how do I do a require_once inside dashboard_payments.php to call the file gateway/config.php? How would the require_once or include line look like?

  • Why would you need to do this?
    – Jeff W
    Jul 19, 2020 at 4:12

2 Answers 2


Since 4.7 get_theme_file_path() is the right function to use:

require_once get_theme_file_path( 'gateway/config.php' );

You can use either

require_once(get_stylesheet_directory() . '/gateway/config.php');

or (should be faster)

require_once(__DIR__ . '/gateway/config.php');

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .