> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mainwp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to add WP Admin button to the main Navigation bar

> Add the WP Admin link back to the MainWP Dashboard navigation sidebar using PHP and CSS code snippets with the Custom Dashboard extension.

Open the three-line **MainWP menu** in the top-right corner of MainWP Dashboard and select **Go to WP Admin** (`/wp-admin/index.php`). If you prefer having the link in the main navigation sidebar, you can add it using PHP and CSS snippets.

## What You'll Learn

* How to add a WP Admin link to the sidebar
* How to position it at the bottom of the navigation

## Prerequisites

* [Custom Dashboard extension](https://docs.mainwp.com/add-ons/development/mainwp-custom-dashboard-extension.md) (free)

***

## Add the WP Admin Button

This requires both a PHP snippet (to create the menu item) and a CSS snippet (to position it at the bottom).

### Step 1: Add PHP Code

**1. Open Custom Dashboard**

Navigate to the Custom Dashboard extension settings.

**2. Add the PHP snippet**

Go to the **PHP** tab and add this code:

```php theme={null}
add_filter( 'mainwp_main_menu', 'mycustom_mainwp_main_menu', 10, 1 );
function mycustom_mainwp_main_menu( $left_menu ) {
    $index = 10; // Position in the menu
    $sub_menu_after = array_splice( $left_menu['leftbar'], $index );

    $addition_item = array();

    $addition_item[] = 'WP Admin';           // Menu item title
    $addition_item[] = '';                   // Parent key
    $addition_item[] = 'index.php';          // URL to WP Admin dashboard
    $addition_item[] = 'custom-wp-admin-item'; // HTML ID attribute
    $addition_item[] = '';                   // Icon (optional)

    $left_menu['leftbar'][] = $addition_item;
    $left_menu['leftbar'] = array_merge( $left_menu['leftbar'], $sub_menu_after );

    return $left_menu;
}
```

![Custom Dashboard - PHP Code Snippet](https://mintcdn.com/mainwp/HAFny0Nanby6rgrO/images/developers/54a20beffc3b.webp?fit=max\&auto=format\&n=HAFny0Nanby6rgrO\&q=85\&s=b7f5da71f0ae5dff0bfa100c8190d0f8)

**3. Save the PHP code**

Click **Save Changes**.

### Step 2: Add CSS Code

**1. Go to CSS tab**

Switch to the **CSS** tab in the Custom Dashboard extension.

**2. Add the CSS snippet**

Add this code to position the button at the bottom of the sidebar:

```css theme={null}
#custom-wp-admin-item {
    padding-left: 10px;
    padding-right: 10px;
    position: absolute;
    bottom: 0;
}
```

![Custom Dashboard - CSS snippet](https://mintcdn.com/mainwp/4hVi87YDiCv3ZeGl/images/developers/b4bfe36309ff.webp?fit=max\&auto=format\&n=4hVi87YDiCv3ZeGl\&q=85\&s=2a8aa455fa4c552ea9ed2e4a3f0bc2e7)

**3. Save the CSS code**

Click **Save Changes**. The WP Admin button now appears at the bottom of the navigation sidebar.

***

## Customization Options

| Option | Change |
| - | - |
| Position in menu | Modify `$index` value (lower = higher in menu) |
| Button text | Change `'WP Admin'` to your preferred label |
| Link destination | Change `'index.php'` to another admin page |
| Visual position | Modify CSS `bottom` value or remove `position: absolute` |

***

## Self-Check Checklist

* [ ] Custom Dashboard extension installed
* [ ] PHP code added to PHP tab
* [ ] CSS code added to CSS tab
* [ ] Both snippets saved
* [ ] WP Admin button visible in navigation sidebar

***

## Related Resources

* [Add Menu Entries](https://docs.mainwp.com/customization/add-new-menu-entries-to-the-mainwp-dashboard-navigation.md) - Add other custom menu items
* [Custom Dashboard Extension](https://docs.mainwp.com/add-ons/development/mainwp-custom-dashboard-extension.md) - Full extension documentation


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.