从一个函数或使用myadd_filter
一次?如果我不能在一个过滤器中组合多个功能或操作,我应该使用什么正确的命名来避免冲突?
我正在修改wp job manager Resume插件的“添加简历”页面。我正在按照他们网站上的教程添加、删除和(现在)重命名字段。Editing Resume Form. 我正在使用add\\u filter,我想看看如何通过将我想要制作的许多过滤器组合成一个函数来优化我正在做的事情。我想看看是否有办法将多个过滤器组合成一个:
// Add our own function to filter the fields
add_filter( \'submit_resume_form_fields\', \'custom_submit_resume_form_fields\' );
// This is the function which takes the fields, modifies them, and returns them
function custom_submit_resume_form_fields( $fields ) {
$fields[\'resume_fields\'][\'candidate_title\'][\'label\'] = "Job Type";
return $fields;
}
add_filter( \'submit_resume_form_fields\', \'custom_submit_resume_form_fields\' );
function custom_submit_resume_form_fields( $fields ) {
$fields[\'resume_fields\'][\'candidate_photo\'][\'label\'] = "Profile Image";
return $fields;
}
所以我想以这样的方式结束
add_filter( \'submit_resume_form_fields\', \'custom_submit_resume_form_fields\' );
function custom_submit_resume_form_fields( $fields ) {
$fields[\'resume_fields\'] array([\'candidate_title\'][\'label\'] = "Job Type",
[\'candidate_photo\'][\'label\'] = "Profile Image");
return $fields;
}