acf_field_taxonomy::save_post() public ACF 5.0.9
This function will save any terms in the save_post_terms array
{} Это метод класса: acf_field_taxonomy{}
Хуков нет.
Возвращает
n/a.
Использование
$acf_field_taxonomy = new acf_field_taxonomy(); $acf_field_taxonomy->save_post( $post_id );
- (int)($post_id) (обязательный)
Список изменений
С версии 5.0.9 | Введена. |
Код acf_field_taxonomy::save_post() acf field taxonomy::save post ACF 5.9.1
function save_post( $post_id ) {
// Check for saved terms.
if( !empty($this->save_post_terms) ) {
// Determine object ID allowing for non "post" $post_id (user, taxonomy, etc).
// Although not fully supported by WordPress, non "post" objects may use the term relationships table.
// Sharing taxonomies across object types is discoraged, but unique taxonomies work well.
// Note: Do not attempt to restrict to "post" only. This has been attempted in 5.8.9 and later reverted.
$info = acf_get_post_id_info( $post_id );
// Loop over taxonomies and save terms.
foreach( $this->save_post_terms as $taxonomy => $term_ids ){
wp_set_object_terms( $info['id'], $term_ids, $taxonomy, false );
}
// Reset storage.
$this->save_post_terms = array();
}
}