ACF_Post_Type::flush_post_cache
Flush rewrite rules whenever anything changes about a post type.
Метод класса: ACF_Post_Type{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ACF_Post_Type = new ACF_Post_Type(); $ACF_Post_Type->flush_post_cache( $post );
- $post(массив) (обязательный)
- The main post type array.
Список изменений
| С версии 6.1 | Введена. |
Код ACF_Post_Type::flush_post_cache() ACF Post Type::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 post type.
if ( empty( $post['post_type'] ) ) {
return;
}
// Temporarily unregister the post type so that we can potentially re-register with the latest args below.
if ( empty( $post['active'] ) || post_type_exists( $post['post_type'] ) ) {
unregister_post_type( $post['post_type'] );
}
// When this is being called, the post type may not have been registered yet, so we do it now.
if ( ! empty( $post['active'] ) ) {
register_post_type( $post['post_type'], $this->get_post_type_args( $post ) );
}
// Flush our internal cache and the WordPress rewrite rules.
parent::flush_post_cache( $post );
flush_rewrite_rules();
}