# Custom Scripts

Mapster WP Maps is built to allow developers to easily extend and tweak map display and settings. We have a huge number of ways you can hook into specific maps during runtime to execute functions and modify content. Custom Scripts is the simplest way to get developer access.

{% embed url="<https://www.youtube.com/watch?v=ZAuJYJ6IoA8>" %}

Custom Scripts are scripts you can write somewhere in the Javascript on your site, and then give to a specific map to call after it's done initializing. This is a simple way to hook into any given map and manipulate displays or controls as you need.

For any particular map, go to the Custom section. Enter the name of a function here. For example, let's call our function "myCustomScript".

Create a global function with that script name. Your script will automatically receive a "map" and a "features" variable. For Maplibre and Mapbox, this will be a map object matching those libraries; for Google Maps, it'll be a map object matching the Google Maps API. As follows:

```
window.myCustomScript = function(map, features) {
	console.log(map);
	console.log(features);
}
```

From here, make the modifications you need!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wpmaps-docs.mapster.me/developer/custom-scripts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
