ACF_Admin_Internal_Post_Type_List::check_duplicate
Checks for the custom "duplicate" action.
Метод класса: ACF_Admin_Internal_Post_Type_List{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$ACF_Admin_Internal_Post_Type_List = new ACF_Admin_Internal_Post_Type_List(); $ACF_Admin_Internal_Post_Type_List->check_duplicate();
Список изменений
С версии 5.9.0 | Введена. |
Код ACF_Admin_Internal_Post_Type_List::check_duplicate() ACF Admin Internal Post Type List::check duplicate ACF 6.4.2
public function check_duplicate() { // Verify capability. if ( ! acf_current_user_can_admin() ) { return; } $args = acf_request_args( array( 'acfduplicatecomplete' => '', 'acfduplicate' => '', 'post' => '', 'action2' => '', ) ); // Display notice on success redirect. if ( ! empty( $args['acfduplicatecomplete'] ) ) { check_admin_referer( 'bulk-posts' ); $duplicated = array_map( 'intval', explode( ',', $args['acfduplicatecomplete'] ) ); $text = $this->get_action_notice_text( 'acfduplicatecomplete', count( $duplicated ) ); $links = array(); foreach ( $duplicated as $duplicated_id ) { $links[] = sprintf( '<a href="%1$s">%2$s</a>', get_edit_post_link( $duplicated_id ), get_the_title( $duplicated_id ) ); } $text .= ' ' . implode( ', ', $links ); acf_add_admin_notice( $text, 'success' ); return; } // Find items to duplicate. $to_duplicate = array(); if ( ! empty( $args['acfduplicate'] ) ) { $to_duplicate[] = intval( $args['acfduplicate'] ); } elseif ( ! empty( $args['post'] ) && 'acfduplicate' === $args['action2'] ) { $to_duplicate = array_map( 'intval', $args['post'] ); } if ( ! empty( $to_duplicate ) ) { check_admin_referer( 'bulk-posts' ); $duplicated_ids = array(); $nonce = wp_create_nonce( 'bulk-posts' ); foreach ( $to_duplicate as $id ) { $field_group = acf_duplicate_field_group( $id ); $duplicated_ids[] = $field_group['ID']; } // Redirect. wp_safe_redirect( $this->get_admin_url( '&_wpnonce=' . $nonce . '&acfduplicatecomplete=' . implode( ',', $duplicated_ids ) ) ); exit; } }