admin管理员组文章数量:1307827
Trying to run the same function for multiple actions. I've got it working for ACF, but the Admin Columns action has a class, and I think that's where I'm struggling, though I'm not sure.
//Works:
function acp_editing_saved_usage28( AC\Column $column, $post_id, $value ) {
if ( get_post_type( $post_id ) == 'vbrands-products' ) {
update_field( 'field_5ff7af3315c5b', 'hoop', $post_id);
}
}
add_action( 'acp/editing/saved', 'acp_editing_saved_usage28', 10, 3 );
//Does not work, but should:
function testfunction(){
if ( get_post_type( $post_id ) == 'vbrands-products' ) {
update_field( 'field_5ff7af3315c5b', 'tedsssst', $post_id);
}
}
function acp_editing_saved_usage28( AC\Column $column, $post_id, $value ) {
testfunction();
}
add_action( 'acp/editing/saved', 'acp_editing_saved_usage28', 10, 3 );
//However, this does work with ACF and the following code using the same testfunction() from above:
function my_acf_save_post88( $post_id ) {
testfunction();
}
add_action('acf/save_post', 'my_acf_save_post88');
本文标签: Issue passing action class to nested function Admin Columns
版权声明:本文标题:Issue passing action class to nested function. Admin Columns 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741849880a2401000.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论