Can a theme use ABSPATH

Hi,

Can my theme use ABSPATH to include files? Example:

require_once ABSPATH . ‘wp-admin/includes/import.php’;

The reviewer did not specifically mention ABSPATH however they did state the following (I have fixed the obvious violations):

##################

Use an appropriate path when including theme files:

  • get_template_directory(): Returns the absolute template directory path.
  • get_template_directory_uri(): Returns the template directory URI.
  • get_stylesheet_directory(): Returns the absolute stylesheet directory path.
  • get_stylesheet_directory_uri(): Returns the stylesheet directory URI.

Don’t use: dirname(FILE), basename( FILE ) or anything else not listed above.

##################

Thanks in advance!

why not use site_url ?

https://codex.wordpress.org/Function_Reference/site_url

Unfortunately site_url() returns the site URL and ABSPATH returns the file location. Example:
ABSPATH - /Applications/MAMP/htdocs/theme/
site_url() - http://localhost/theme/ (wont work for including)

Thanks anyways!

Yes. It’s can.

Awesome thanks!