Title: WP_Comments_List_Table::get_bulk_actions
Published: April 25, 2014
Last modified: February 24, 2026

---

# WP_Comments_List_Table::get_bulk_actions(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_comments_list_table/get_bulk_actions/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_comments_list_table/get_bulk_actions/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_comments_list_table/get_bulk_actions/?output_format=md#related)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_comments_list_table/get_bulk_actions/?output_format=md#wp--skip-link--target)

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_comments_list_table/get_bulk_actions/?output_format=md#return)󠁿

 array

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_comments_list_table/get_bulk_actions/?output_format=md#source)󠁿

    ```php
    protected function get_bulk_actions() {
    	global $comment_status;

    	if ( ! current_user_can( 'moderate_comments' ) ) {
    		return array(); // Return an empty array if the user doesn't have permission
    	}

    	$actions = array();

    	if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) {
    		$actions['unapprove'] = __( 'Unapprove' );
    	}

    	if ( in_array( $comment_status, array( 'all', 'moderated' ), true ) ) {
    		$actions['approve'] = __( 'Approve' );
    	}

    	if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ), true ) ) {
    		$actions['spam'] = _x( 'Mark as spam', 'comment' );
    	}

    	if ( 'trash' === $comment_status ) {
    		$actions['untrash'] = __( 'Restore' );
    	} elseif ( 'spam' === $comment_status ) {
    		$actions['unspam'] = _x( 'Not spam', 'comment' );
    	}

    	if ( in_array( $comment_status, array( 'trash', 'spam' ), true ) || ! EMPTY_TRASH_DAYS ) {
    		$actions['delete'] = __( 'Delete permanently' );
    	} else {
    		$actions['trash'] = __( 'Move to Trash' );
    	}

    	return $actions;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-comments-list-table.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/class-wp-comments-list-table.php#L362)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/class-wp-comments-list-table.php#L362-L396)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_comments_list_table/get_bulk_actions/?output_format=md#related)󠁿

| Uses | Description | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [_x()](https://developer.wordpress.org/reference/functions/_x/)`wp-includes/l10n.php` |

Retrieves translated string with gettext context.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_comments_list_table/get_bulk_actions/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_comments_list_table/get_bulk_actions/?output_format=md#)

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_comments_list_table%2Fget_bulk_actions%2F)
before being able to contribute a note or feedback.