Which template renders a URL
get_template_for_urlResolve the exact WordPress template file or block template behind any URL, with hierarchy, customizations, and queried object.
Instructions
Answer "which template file (or block template and template parts) renders this URL, and why?" — the resolved file, the template hierarchy WordPress tried, whether a block template or part has been customised in the Site Editor, the queried object and the conditional tags that were true. A lightweight profile_url. Needs the companion plugin.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Path or full URL on the site. | / |
| site_id | No | Which configured WordPress site to act on. Optional — with a single site configured it is used automatically; with several, the default site is used unless you name one. Run list_sites for valid ids. | |
| as_logged_in | No | Resolve as the logged-in administrator instead of an anonymous visitor. |