ACF_Internal_Post_Type::validate_post
Validates an ACF internal post type.
Method of the class: ACF_Internal_Post_Type{}
Hooks from the method
Returns
Array.
Usage
$ACF_Internal_Post_Type = new ACF_Internal_Post_Type(); $ACF_Internal_Post_Type->validate_post( $post );
- $post(array)
- The main post array.
Default:array()
Changelog
| Since 6.1 | Introduced. |
ACF_Internal_Post_Type::validate_post() ACF Internal Post Type::validate post code ACF 6.8.8
public function validate_post( $post = array() ) {
// Bail early if already valid.
if ( is_array( $post ) && ! empty( $post['_valid'] ) ) {
return $post;
}
$post = wp_parse_args(
$post,
$this->get_settings_array()
);
// Convert types.
$post['ID'] = (int) $post['ID'];
$post['menu_order'] = (int) $post['menu_order'];
$post['active'] = (bool) $post['active'];
// Post is now valid.
$post['_valid'] = true;
/**
* Filters the ACF post array to validate settings.
*
* @date 12/02/2014
* @since 5.0.0
*
* @param array $post The post array.
*/
return apply_filters( "acf/validate_{$this->hook_name}", $post );
}