ACF_Admin_Internal_Post_Type_List::check_deactivate
Checks for the custom "Deactivate" bulk 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_deactivate();
Список изменений
С версии 6.0 | Введена. |
Код ACF_Admin_Internal_Post_Type_List::check_deactivate() ACF Admin Internal Post Type List::check deactivate ACF 6.4.2
public function check_deactivate() { // Verify capability. if ( ! acf_current_user_can_admin() ) { return; } $args = acf_request_args( array( 'acfdeactivatecomplete' => '', 'acfdeactivate' => '', 'post' => '', 'action2' => '', ) ); // Display notice on success redirect. if ( ! empty( $args['acfdeactivatecomplete'] ) ) { check_admin_referer( 'bulk-posts' ); $deactivated = array_map( 'intval', explode( ',', $args['acfdeactivatecomplete'] ) ); $text = $this->get_action_notice_text( 'acfdeactivatecomplete', count( $deactivated ) ); $links = array(); foreach ( $deactivated as $deactivated_id ) { $links[] = sprintf( '<a href="%1$s">%2$s</a>', get_edit_post_link( $deactivated_id ), get_the_title( $deactivated_id ) ); } $text .= ' ' . implode( ', ', $links ); // Add notice. acf_add_admin_notice( $text, 'success' ); return; } // Find items to deactivate. $to_deactivate = array(); if ( ! empty( $args['acfdeactivate'] ) ) { $to_deactivate[] = intval( $args['acfdeactivate'] ); } elseif ( ! empty( $args['post'] ) && 'acfdeactivate' === $args['action2'] ) { $to_deactivate = array_map( 'intval', $args['post'] ); } if ( ! empty( $to_deactivate ) ) { check_admin_referer( 'bulk-posts' ); $deactivated_ids = array(); $nonce = wp_create_nonce( 'bulk-posts' ); foreach ( $to_deactivate as $id ) { $post_type = get_post_type( $id ); if ( $post_type && acf_update_internal_post_type_active_status( $id, false, $post_type ) ) { $deactivated_ids[] = $id; } } wp_safe_redirect( $this->get_admin_url( '&_wpnonce=' . $nonce . '&acfdeactivatecomplete=' . implode( ',', $deactivated_ids ) ) ); exit; } }