What’s the best way to ‘include’ a file in WordPress?
You can include the PHP files in WordPress just the same way you do it anywhere else. However, WordPress offers more constants and functions for defining a path for the include() function. Instead of using $_SERVER[“DOCUMENT_ROOT”], move your PHP file to your theme’s folder, and use this to include it: require_once ( get_template_directory() . “/data.php”); … Read more