ACF_Taxonomy::flush_post_cache
Flush rewrite rules whenever anything changes about a taxonomy.
Метод класса: ACF_Taxonomy{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ACF_Taxonomy = new ACF_Taxonomy(); $ACF_Taxonomy->flush_post_cache( $post );
- $post(массив) (обязательный)
- The main post type array.
Список изменений
| С версии 6.1 | Введена. |
Код ACF_Taxonomy::flush_post_cache() ACF Taxonomy::flush post cache ACF 6.4.2
public function flush_post_cache( $post ) {
// Bail early if we won't be able to register/unregister the taxonomy.
if ( ! isset( $post['taxonomy'] ) ) {
return;
}
// Temporarily unregister the taxonomy so that we can re-register with the latest args below.
if ( empty( $post['active'] ) || taxonomy_exists( $post['taxonomy'] ) ) {
unregister_taxonomy( $post['taxonomy'] );
}
// When this is being called, the post type may not have been registered yet, so we do it now.
if ( ! empty( $post['active'] ) ) {
$post['object_type'] = isset( $post['object_type'] ) ? (array) $post['object_type'] : array();
register_taxonomy( $post['taxonomy'], $post['object_type'], $this->get_taxonomy_args( $post ) );
}
parent::flush_post_cache( $post );
flush_rewrite_rules();
}