# Integrating Aurelia with WordPress backend

**URL:** <https://discourse.aurelia.io/t/integrating-aurelia-with-wordpress-backend/5474>\
**Category:** Uncategorized\
**Created:** [June 26, 2024, 4:28am UTC](https://discourse.aurelia.io/t/integrating-aurelia-with-wordpress-backend/5474 "2024-06-26T04:28:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivan](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/ivan/32/2022_2.png) [@ivan](https://discourse.aurelia.io/u/ivan)\
**Post date:** [June 26, 2024, 4:28am UTC](https://discourse.aurelia.io/t/integrating-aurelia-with-wordpress-backend/5474/1 "2024-06-26T04:28:54Z")

</div>

I would like to create a WordPress plugin. The plugin adds a panel to the WordPress admin interface. This panel should host an Aurelia application.

I have successfully gotten the Aurelia application to work in WordPress.

 ![Screenshot 2024-06-25 at 16.18.17](https://canada1.discourse-cdn.com/flex027/uploads/aurelia/original/2X/9/9c0bb911cd892ae0e95d2fcbe217ccf5db55dd43.png)

All WordPress does at the moment is this:

```auto
function render_admin_screen() {
    echo '<my-app></my-app>';
    echo '<script type="module" src="http://localhost:9000/entry.bundle.js"></script>';
}

```

Which translates to adding the two html tags when the user clicks on the plugin name on the side menu.

Yay, this is working. It even automatically updates when changes are made to the code.

Now the next step is to add routing. The url of the page is structured like this `http://localhost:8888/wp-admin/admin.php?page=PluginName`.

Adding in router lite-config

```auto
.register(RouterConfiguration.customize({
    useUrlFragmentHash: true
  }))

```

and routes

```auto
@route({
  routes: [
    { path: '', redirectTo: 'database' },
    {
      path: 'database',
      component: DatabaseRoute,
      title: 'Database',
    },
    {
      path: 'settings',
      component: SettingsRoute,
      title: 'Settings',
    },
  ],
  fallback: 'database'
})

```

Now with routing turned on, when the au app is activated the url changes to this:  
`http://localhost:8888/wp-admin/admin.php?page=PluginName/#/database?page=PluginName`

Navigating to one of the routes then changes it back to this:

`http://localhost:8888/wp-admin/admin.php?page=PluginName/#/settings`

Looks like everything works as expected here.

* * *

I guess another approach is to swap the `my-app` tag for an iframe

```auto
function render_admin_screen() {
	echo '<iframe src="http://localhost:9000/index"></iframe>'; 
}

```

Everything works as expected here.

* * *

Has anyone tried something similar? Any tips?
