ACF_Internal_Post_Type::get_raw_post
Retrieves raw post data for the given identifier.
Метод класса: ACF_Internal_Post_Type{}
Хуков нет.
Возвращает
array|false. The field group array, or false on failure.
Использование
$ACF_Internal_Post_Type = new ACF_Internal_Post_Type(); $ACF_Internal_Post_Type->get_raw_post( $id );
- $id(int|строка)
- The field ID, key or name.
Список изменений
| С версии 6.1 | Введена. |
Код ACF_Internal_Post_Type::get_raw_post() ACF Internal Post Type::get raw post ACF 6.8.8
public function get_raw_post( $id = 0 ) {
// Get raw internal post from database.
$post = $this->get_post_object( $id );
if ( ! $post ) {
return false;
}
// Bail early if incorrect post type.
if ( $post->post_type !== $this->post_type ) {
return false;
}
// Unserialize post_content.
$raw_post = (array) acf_maybe_unserialize( $post->post_content );
// Update attributes.
$raw_post['ID'] = $post->ID;
$raw_post['title'] = $post->post_title;
$raw_post['key'] = $post->post_name;
$raw_post['menu_order'] = $post->menu_order;
$raw_post['active'] = in_array( $post->post_status, array( 'publish', 'auto-draft' ) );
return $raw_post;
}