Php 无法访问Wordpress中的回调
我正在wordpress中构建一个主题,我已经安装了WooCommerce。当查看商店页面时,有一个不同的标题,或者更确切地说,根本没有标题。在任何情况下,它既不是我设计的标题,也不是第一次访问url时显示的标题。页面顶部的错误显示为Php 无法访问Wordpress中的回调,php,wordpress,Php,Wordpress,我正在wordpress中构建一个主题,我已经安装了WooCommerce。当查看商店页面时,有一个不同的标题,或者更确切地说,根本没有标题。在任何情况下,它既不是我设计的标题,也不是第一次访问url时显示的标题。页面顶部的错误显示为 call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /Applications/MAMP/htdocs/band/wp-inc
call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /Applications/MAMP/htdocs/band/wp-includes/plugin.php on line 213
这是调用堆栈
调用堆栈
# Time Memory Function Location
1 0.0001 232984 {main}( ) ../index.php:0
2 0.0002 235792 require( '/Applications/MAMP/htdocs/band/wp-blog-header.php' ) ../index.php:17
3 0.4528 36798136 wp( ) ../wp-blog-header.php:14
4 0.4528 36798400 WP->main( ) ../functions.php:873
5 0.4566 36808800 WP->query_posts( ) ../class-wp.php:611
6 0.4566 36809288 WP_Query->query( ) ../class-wp.php:540
7 0.4566 36817776 WP_Query->get_posts( ) ../query.php:3836
8 0.4573 36834600 do_action_ref_array( ) ../query.php:2377
9 0.4574 36836056 call_user_func_array:{/Applications/MAMP/htdocs/band/wp-includes/plugin.php:571} ( ) ../plugin.php:571
10 0.4574 36837200 WC_Query->pre_get_posts( ) ../plugin.php:571
11 0.4574 36837792 WC_Query->product_query( ) ../class-wc-query.php:294
12 0.4577 36840584 apply_filters( ) ../class-wc-query.php:438
13 0.4578 36841976 call_user_func_array:{/Applications/MAMP/htdocs/band/wp-includes/plugin.php:213} ( ) ../plugin.php:213
来自plugin.php
do { foreach( (array) current($wp_filter[$tag]) as $the_ ) if ( !is_null($the_['function']) ){ $args[1] = $value; $value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args'])); } } while ( next($wp_filter[$tag]) !== false );
当我在plugin.php的第213行停止时,我尝试在我的本地机器上调试与框架对应的变量的值,但是有人可能仅仅通过查看就知道出了什么问题吗
更新:
我在functions.php中注释掉了这些代码行,错误消失了
/*
function products_per_page_category( $count ) {
return $count;
}
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);
*/
//add_filter( 'loop_shop_per_page', products_per_page_category( 20 ));
但是,它仍然没有使用与我的模板的其余部分相同的标题。您可以显示代码吗?您还需要查看哪些其他代码,如果最后一篇文章很混乱,很抱歉。正在尝试将其格式化。您的代码将插入挂钩/筛选器。这看起来像你刚刚发布的WP代码。是的,我没有写任何插件代码,我做的唯一一件事就是将WooCommerce模板移动到themes文件夹,这样我就可以在不更改源代码的情况下进行自定义编辑。当你将文件移回时,它是否正常工作?