Php 我在执行删除操作之前执行删除操作,但操作仍被激发?
我不明白为什么这样不行。我的理解是,您必须在添加操作后但在启动之前删除该操作。这就是我在这里做的?这里有什么我不明白的吗?调试wordpress真的让我很困惑,因为你真的无法完成它Php 我在执行删除操作之前执行删除操作,但操作仍被激发?,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,我不明白为什么这样不行。我的理解是,您必须在添加操作后但在启动之前删除该操作。这就是我在这里做的?这里有什么我不明白的吗?调试wordpress真的让我很困惑,因为你真的无法完成它 <?php /** * Functions hooked into storefront_header action * * @hooked storefront_header_container - 0 * @hooked sto
<?php
/**
* Functions hooked into storefront_header action
*
* @hooked storefront_header_container - 0
* @hooked storefront_skip_links - 5
* @hooked storefront_social_icons - 10
* @hooked storefront_site_branding - 20
* @hooked storefront_secondary_navigation - 30
* @hooked storefront_product_search - 40
* @hooked storefront_header_container_close - 41
* @hooked storefront_primary_navigation_wrapper - 42
* @hooked storefront_primary_navigation - 50
* @hooked storefront_header_cart - 60
* @hooked storefront_primary_navigation_wrapper_close - 68
*/
remove_action('storefront_header', 'storefront_product_search', 40);
do_action( 'storefront_header' );
?>
请参阅以下网站上提供的注释: 如果某个操作是从类中添加的,例如通过插件添加的,则删除该操作将需要通过保存该类实例的变量访问该类 要删除操作,优先级必须与最初添加的函数的优先级相匹配
我更改了优先级以匹配添加操作,但仍然没有运气。操作
storefront\u product\u search
不是从类中添加的。它添加在hooks.php文件中。您试图从哪个文件运行remove\u action
?好的。。。它刚刚开始工作。谢谢你的帮助!