我在没有任何文档的情况下接管了 WordPress 网站的“管理员”,并且在创建带有此错误的发票时它崩溃了。虽然我可以做一些事情来让它继续运行,但我无法修复损坏的 PHP 代码,我希望有人可以帮我修复这个问题,使其再次正常工作。
已弃用:函数 create_function() 在 ../public_html/news/wp-content/themes/twentyseventeen-child/functions.php 第 12 行已弃用
functions.php中的代码如下所示
<?php
add_filter( 'password_reset_expiration', function( $expiration ) {
return MONTH_IN_SECONDS;
});
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
add_action( 'woocommerce_single_product_summary', create_function( '', 'echo "<b><a href=\"https://009society.com/news/shop\">Continue Shopping</a></b>";' ), 35 );
// Increase the password expiration expiration to 5 days
add_filter('password_reset_expiration',function($expiration){return 5 * DAY_IN_SECONDS;});
// 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' );
if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
function chld_thm_cfg_parent_css() {
wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( ) );
}
endif;
add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 );
if ( !function_exists( 'child_theme_configurator_css' ) ):
function child_theme_configurator_css() {
wp_enqueue_style( 'chld_thm_cfg_separate', trailingslashit( get_stylesheet_directory_uri() ) . 'ctc-style.css', array( 'chld_thm_cfg_parent','twentyseventeen-style','twentyseventeen-block-style','twentyseventeen-colors-dark' ) );
}
endif;
add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', 10 );
// END ENQUEUE PARENT ACTION
希望有好心人帮我修复这个错误,让网站重新正常运行,直到目前的整体重新设计完成。
非常感谢
伊恩·莫里森
由于没有 PHP 知识,我决定最好不要尝试任何东西,因为我可能会完全破坏它!
您可以使用匿名函数,而不是通过
create_function
创建函数。
例如:
add_action( 'woocommerce_single_product_summary', function(){
echo "<b><a href=\"https://009society.com/news/shop\">Continue Shopping</a></b>";
}, 35 );
请注意,Stack Overflow 不是查找免费软件开发服务的地方。你应该先尝试自己解决问题。