WordPress主题中的PHP”警告include_once()(无法打开流”)

我正在构建一个WordPress主题, 并使用了一些分解功能, 这些功能可用于自定义主题到主题根目录中的库子目录中, 并将它们包含在include_once()函数中。
【WordPress主题中的PHP” 警告include_once()(无法打开流” )】我进一步将文件分解为库内的子目录, 并包括每个具有正确路径的文件。
我以这种方式包括了将近20个文件, 没有任何问题, 但是在library / post-types目录中有一个文件locations-post-type.php, 如果包含该文件, 则会触发以下错误:

警告:include_once(library / post-types / locations-post-type.php):无法打开流:第98行的MY-THEME-PATH / wp-content / themes / caris / functions.php中没有此类文件或目录警告:include_once():无法在MY-THEME-中打开” library / post-types / locations-post-type.php” 以包含在内(include_path =’ 。:/ opt / alt / php70 / usr / share / pear’ )第98行的PATH / wp-content / themes / caris / functions.php
/ library / post-types子目录中有8个文件, 所有文件都具有相同的权限和所有权。运行ls -l命令返回:
-rw-rw-r-- 1 rivalmi1 rivalmi1 5930 Jun 102019 careers-post-type.php -rw-rw-r-- 1 rivalmi1 rivalmi1 5883 Jun 102019 events-post-type.php -rw-rw-r-- 1 rivalmi1 rivalmi1 3066 Jun 102019 faqs-post-type.php -rw-rw-r-- 1 rivalmi1 rivalmi1 3115 Jun 102019 history-post-type.php -rw-rw-r-- 1 rivalmi1 rivalmi1 7181 Jun 102019 locations-post-type.php -rw-rw-r-- 1 rivalmi1 rivalmi1 5121 Jun 102019 team-post-type.php -rw-rw-r-- 1 rivalmi1 rivalmi1 3164 Jun 102019 testimonials-post-type.php -rw-rw-r-- 1 rivalmi1 rivalmi1 6031 Jun 102019 workshops-post-type.php

我看不到locations-post-type.php文件与其他所有可以包含include_once()且没有错误的文件有任何区别。
而且locations-post-type.php在我的XAMPP localhost服务器上也能正常工作, 并且只会在我的登台服务器上导致错误。
有谁知道是什么引起了这个问题?
#1尝试使用get_template_directory()(或将get_stylesheet_directory()用于子主题)以确保你需要从所需位置获取文件。
require_once( trailingslashit( get_template_directory() ) . 'library/post-types/locations-post-type.php' );

    推荐阅读