I'm trying to add a "convenience" link from within a plugin to it's general settings page. In the General Settings custom cpTriggers and baseCpUrl can be set to custom values and I'm wondering if there is a easy Craft variable to retrieve a link to the site's correct settings page. It would create something like this in a template.


Any thoughts? I could write some logic in the plugin to dig it out but it seems like I might be overlooking something obvious. Any thoughts?

1 Answer 1


Add a public getSettingsUrl() function to your main plugin file that returns a URL string.

A full URL is not required -- you can simply return "pluginname/settings".

If this is left blank, a simple settings page will be provided, filled with whatever getSettingsHtml() returns.

You can then get the URL from elsewhere in Craft using the PluginsService.


or PluginsVariable:

{{ craft.plugins.getPlugin('pluginname').getSettingsUrl }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.