acf_field_taxonomy::save_post()
save_post
This function will save any terms in the save_post_terms array
@type function
{} Это метод класса: acf_field_taxonomy{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$acf_field_taxonomy = new acf_field_taxonomy(); $acf_field_taxonomy->save_post( $post_id );
- $post_id (обязательный)
- -
Список изменений
С версии 5.0.9 | Введена. |
Код acf_field_taxonomy::save_post() acf field taxonomy::save post ACF 5.10.2
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. extract( acf_decode_post_id( $post_id ) ); if ( $type === 'block' ) { // Get parent block... } // Loop over taxonomies and save terms. foreach ( $this->save_post_terms as $taxonomy => $term_ids ) { wp_set_object_terms( $id, $term_ids, $taxonomy, false ); } // Reset storage. $this->save_post_terms = array(); } }