How to Limit the Number of Concurrently Open Tickets

If you wish to limit the number of tickets a user can have opened at the same time, you can hook into the submission process using the wpas_before_submit_new_ticket_checks filter.


add_filter( ‘wpas_before_submit_new_ticket_checks’, ‘wpas_limit_concurrently_open_tickets’ );
* Limit the Number of Concurrent Open Tickets
* @param bool|WP_Error $go Submission status
* @return bool|WP_Error
function wpas_limit_concurrently_open_tickets( $go ) {
var_dump( $go );
$user_id = get_current_user_id();
$open_tickets = wpas_get_user_tickets( $user_id, ‘open’ );
$limit = 1; // Set the maximum number of open ticket a user can have at any given time
$count = count( $open_tickets );
if ( $count >= $limit ) {
// Make sure $go is not already errored
if ( ! is_wp_error( $go ) ) {
$go = new WP_Error();
// Add a custom error message
$go->add( ‘too_many_open_tickets’, sprintf( ‘You can not have more than %1$d tickets open at the same time (you currently have %2$d open tickets). Please close your tickets before opening a new one.’, $limit, $count ) );
return $go;
Don’t want to write your own code?  Then get our Powerpack/Productivity extension which provides a nice, friendly user interface for this feature.
Smart Chat
Smart Replies add-on Chat X