Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress get_template_directory_uri()突然开始返回错误的值_Wordpress_Wordpress Theming_Child Theming - Fatal编程技术网

Wordpress get_template_directory_uri()突然开始返回错误的值

Wordpress get_template_directory_uri()突然开始返回错误的值,wordpress,wordpress-theming,child-theming,Wordpress,Wordpress Theming,Child Theming,在我的网站上,函数get\u template\u directory\u uri()在使用我的子主题时开始返回完全错误的值。就在刚才,所有的一切都在运作,包括儿童主题和一切。然后突然它开始返回http://example.com/~villageofmanento/vmanteno child,应该是http://example.com/~Villageofmanento/yootheme child。现在,整个站点被破坏,所有脚本URL返回404。站点根目录位于/~villageofmane

在我的网站上,函数
get\u template\u directory\u uri()
在使用我的子主题时开始返回完全错误的值。就在刚才,所有的一切都在运作,包括儿童主题和一切。然后突然它开始返回
http://example.com/~villageofmanento/vmanteno child
,应该是
http://example.com/~Villageofmanento/yootheme child
。现在,整个站点被破坏,所有脚本URL返回404。站点根目录位于
/~villageofmanento

这是现在非常奇怪的部分,我得到的URL的最后一段,
vmanteno child
似乎不是来自任何地方。我从未在任何地方键入过,没有文件或主题使用
vmanteo
命名。我的代码中从来没有“vmanteno”这个词。所以我不知道这是从哪里来的

我甚至试着删除我的子主题,重新创建它,复制我的旧文件,但它仍然坏了。当我关闭儿童主题时,一切都很好

子主题文件夹称为
yootheme child

现在,我的子主题中唯一的模板文件是
page meetings.php
,但是这个问题影响了每个页面上的整个站点,所以这与此无关

这是我的
风格。css

/*
Theme Name: YOOtheme Child
Theme URI: https://yootheme.com
Template: yootheme
Author: YOOtheme
Author URI: https://yootheme.com
Description: A powerful, flexible and elegant website builder that allows you to create complex pages within minutes and customize every aspect of the theme.
Version: 1.21.6.1569423942
Updated: 2019-09-25 15:05:42
*/
和my
functions.php

<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;

// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:

if ( !function_exists( 'chld_thm_cfg_locale_css' ) ):
    function chld_thm_cfg_locale_css( $uri ){
        if ( empty( $uri ) && is_rtl() && file_exists( get_template_directory() . '/rtl.css' ) )
            $uri = get_template_directory_uri() . '/rtl.css';
        return $uri;
    }
endif;
add_filter( 'locale_stylesheet_uri', 'chld_thm_cfg_locale_css' );

// END ENQUEUE PARENT ACTION

请注意,
get\u template\u directory\u uri()
将返回父主题的URL,如果希望从子主题获取URL,则应使用
get\u stylesheet\u directory\u uri()


请注意,这两个函数都有允许更改URL的内部筛选器,例如
get\u template\u directory\u uri()
有一个名为
template\u directory\u uri
的筛选器,因此可能有第三方主题或插件正在更改它。

请注意
get\u template\u directory\u uri()
将返回父主题的URL,如果希望从子主题获取URL,则应使用
get\u stylesheet\u directory\u uri()


请注意,这两个函数都有允许更改URL的内部筛选器,例如
get\u template\u directory\u uri()
有一个名为
template\u directory\u uri
的筛选器,因此可能有第三方主题或插件正在更改它。

我已放弃修复此问题。删除旧的子主题并使用相同的名称创建一个新主题会导致相同的问题,但是使用不同的名称创建一个新的子主题却起到了一定的作用。将主题名称更改回yootheme child会再次破坏它。不知道为什么。

我已经放弃修理这个了。删除旧的子主题并使用相同的名称创建一个新主题会导致相同的问题,但是使用不同的名称创建一个新的子主题却起到了一定的作用。将主题名称更改回yootheme child会再次破坏它。不知道为什么。

好吧,它返回的URL也不是我的父主题文件夹,如果是这样的话,它应该是
yootheme
。它与任何东西都不对应。此外,WordPress本身没有为其脚本和CSS导入生成正确的URL,导致所有内容都被404删除。没有安装其他主题。
get\u template\u directory\u uri()
get\u stylesheet\u directory\u uri()
返回的实际上是相同的内容。我也没有更改任何插件,插件也很少。但是如果WordPress本身不能生成正确的URL,那么问题听起来不仅仅是主题,WordPress上有一些代码对其进行了更改。嗯,它返回的URL也不是我的父主题文件夹,如果是这样的话,它应该是
yootheme
。它与任何东西都不对应。此外,WordPress本身没有为其脚本和CSS导入生成正确的URL,导致所有内容都被404删除。没有安装其他主题。
get\u template\u directory\u uri()
get\u stylesheet\u directory\u uri()
返回的实际上是相同的内容。我也没有更改任何插件,而且插件很少。但是如果WordPress本身无法生成正确的URL,那么问题听起来不仅仅是主题,WordPress上会有一些代码更改它。