您只需将相同的筛选器用于a lower or higher priority parameter 对$actions
大堆这样,您可以创建一个小型自定义插件(或修改主题的functions.php
文件),而无需直接修改现有插件。
例如:如果希望自定义代码在add_edit_address_subscription_action
函数,然后对wcs_view_subscription_actions
滤器
示例代码(将其用作自定义插件的一部分或主题的functions.php
文件):
// original filter uses priority 10, so priority 11 will make sure that this function executes after the original implementation
add_filter( \'wcs_view_subscription_actions\', \'wpse_custom_action_after\', 11, 2 );
function wpse_custom_action_after( $actions, $subscription ) {
// your custom changes to $actions array HERE
// this will be executed after add_edit_address_subscription_action function
return $actions;
}
另一方面,如果希望自定义代码在
add_edit_address_subscription_action
函数,然后使用较小的优先级参数(优先级较高)。
示例代码(将其用作自定义插件的一部分或主题的functions.php
文件):
// original filter uses priority 10, so priority 9 will make sure that this function executes before the original implementation
add_filter( \'wcs_view_subscription_actions\', \'wpse_custom_action_before\', 9, 2 );
function wpse_custom_action_before( $actions, $subscription ) {
// your custom changes to $actions array HERE
// this will be executed before add_edit_address_subscription_action function
return $actions;
}