---
title: "How to Add Close Button in Alert Box/Message Box in WordPress?"
url: https://nexterwp.com/docs/add-close-button-in-alert-box-message-box-in-wordpress/
date: 2024-12-04
modified: 2026-03-31
author: "Aditya Sharma"
description: "Do you want to add a close button to the WordPress alert box? Adding a close button to the alert box can improve the user experience by giving an option..."
image: https://nexterwp.com/wp-content/uploads/2024/12/How-to-Add-Close-Button-in-Alert-BoxMessage-Box-in-WordPress-1024x519.jpg
word_count: 160
---

# How to Add Close Button in Alert Box/Message Box in WordPress?

Do you want to add a close button to the WordPress alert box? Adding a close button to the alert box can improve the user experience by giving an option to the users to close the message.

With the Message Box block from Nexter Blocks, you can add a close button to alert boxes or message boxes in WordPress.

*To check the complete feature overview documentation of the Nexter Blocks Message Box block,* [click here](https://nexterwp.com/docs/add-a-message-box-in-wordpress/).

***Requirement  - This block is a part of the Nexter Blocks, make sure it's installed & activated to enjoy all its powers.***

[LIVE BLOCK LINK](https://nexterwp.com/nexter-blocks/blocks/wordpress-table-of-contents/)

To do this, add the Message Box block and follow the steps.

1. Add the title and description from the **Title** and **Description** sections.

2. Then enable the **Close Icon** toggle.

3. After that, add the icon from the **Select Close Icon** section.

Now you’ll see a close button in the alert box, which you can click to close it.