acf_duplicate_internal_post_type()
Duplicates an ACF post.
No Hooks.
Returns
Array|true|false. The new ACF post, or false on failure.
Usage
acf_duplicate_internal_post_type( $id, $new_post_id, $post_type );
- $id(int|string)
- The field_group ID, key or name.
- $new_post_id(int)
- Optional ID to override.
- $post_type(string)
- The post type of the post being duplicated.
Default:'acf-field-group'
Changelog
| Since 6.1 | Introduced. |
acf_duplicate_internal_post_type() acf duplicate internal post type code ACF 6.8.8
function acf_duplicate_internal_post_type( $id = 0, $new_post_id = 0, $post_type = 'acf-field-group' ) {
$instance = acf_get_internal_post_type_instance( $post_type );
if ( $instance ) {
return $instance->duplicate_post( $id, $new_post_id );
}
return false;
}