Php “删除”操作不起作用,但“添加”不起作用
我已经在functions.php文件的底部添加了以下代码,它们并没有从我的产品页面中删除这些函数。我直接从content-single-product.php页面复制了优先级编号,但仍然没有成功Php “删除”操作不起作用,但“添加”不起作用,php,wordpress,woocommerce,product,hook-woocommerce,Php,Wordpress,Woocommerce,Product,Hook Woocommerce,我已经在functions.php文件的底部添加了以下代码,它们并没有从我的产品页面中删除这些函数。我直接从content-single-product.php页面复制了优先级编号,但仍然没有成功 remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); remove_action('woocommerce_single_product_summary', 'woo
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price',10 );
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_excerpt',20 );
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart',30 );
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_meta',40 );
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_sharing' ,50);
remove_action('woocommerce_single_product_summary', 'WC_Structured_Data::generate_product_data()',60 );e
尝试将它们包含在
woocommerce\u single\u product\u summary
action钩子中的自定义函数中,优先级较低,如下所示:
add_action('woocommerce_single_product_summary', 'customizing_single_product_summary_hooks', 2 );
function customizing_single_product_summary_hooks(){
remove_action('woocommerce_single_product_summary','woocommerce_template_single_title', 5 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_rating', 10 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_price',10 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_excerpt',20 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart',30 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_meta',40 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_sharing' ,50);
remove_action('woocommerce_single_product_summary','WC_Structured_Data::generate_product_data()',60 );
}
代码进入活动子主题(或活动主题)的function.php文件
通过这种方式,它应该可以工作尝试将它们包含在
woocommerce\u single\u product\u summary
action hook中的自定义函数中,以较小的优先级通过这种方式:
add_action('woocommerce_single_product_summary', 'customizing_single_product_summary_hooks', 2 );
function customizing_single_product_summary_hooks(){
remove_action('woocommerce_single_product_summary','woocommerce_template_single_title', 5 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_rating', 10 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_price',10 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_excerpt',20 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart',30 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_meta',40 );
remove_action('woocommerce_single_product_summary','woocommerce_template_single_sharing' ,50);
remove_action('woocommerce_single_product_summary','WC_Structured_Data::generate_product_data()',60 );
}
代码进入活动子主题(或活动主题)的function.php文件
这样就可以了回答得好!从技术上讲,最小的优先级应该是
PHP\u INT\u MIN
,但这只是技术性的!)回答得好!从技术上讲,最小的优先级应该是PHP\u INT\u MIN
,但这只是技术性的!)