Print company details and legal page links anywhere with the wpautoterms shortcode
TermsFeed AutoTerms adds a single shortcode, [wpautoterms], whose first attribute picks 1 of 12 variants. The variants print a detail from General Settings, a whole legal page, or the title, link, or date of a legal page. A variant the plugin does not know, or a shortcode with no attribute, prints nothing.
Website and company details shortcodes
The website and company details variants each print a value from TermsFeed > Settings, and a change to the setting reaches every page once your page cache is cleared. Set the values with WordPress Legal Page Settings.
| Shortcode | Prints | Setting |
|---|---|---|
[wpautoterms site_name] |
The website name, as plain text | Website name |
[wpautoterms site_url] |
The website address, limited to an http or https address | Website URL |
[wpautoterms company_name] |
The company name, as plain text | Company name |
[wpautoterms company_address] |
The company address, as plain text | Company address |
[wpautoterms country] |
The English name of the country, or its 2-letter code for a country the plugin has no name for | Country |
[wpautoterms state] |
The English name of the state | State |
Embed a whole legal page with the page shortcode
[wpautoterms page="<slug>"] prints the full content of the published legal page with that slug, inside any post or page, such as a page your WordPress theme already links from its footer. Copy it from the Shortcode column of TermsFeed > All Legal Pages, which shows a child page by its path, parent/child.
[wpautoterms page="privacy-policy"]
[wpautoterms page="policies/privacy-policy"]
The page shortcode follows these rules.
- A password-protected page prints "Password required." The text of the page stays hidden.
- A page never embeds itself. The shortcode prints nothing inside the legal page it names.
- Embeds do not nest. A
pageshortcode inside an embedded page prints nothing. - Only legal pages are embedded. A slug that belongs to a post or a regular page prints nothing.
- Shortcodes inside the embedded page refer to that page. Its "Last updated" line shows the date of the embedded page, not the date of the post around it.
- The embedded page does not show the Endorsements disclaimer. The Endorsements kit does not add a disclaimer to an embedded legal page.
Title, link, and date of a legal page
The page_title, page_link, and last_updated_date variants each take an optional slug, and with one they use the published legal page with that slug.
| Shortcode | Prints |
|---|---|
[wpautoterms page_title], [wpautoterms page_title="<slug>"] |
The title of the page, with any shortcode in the title expanded once |
[wpautoterms page_link], [wpautoterms page_link="<slug>"] |
The permalink of the page, ready for the href of a link |
[wpautoterms last_updated_date], [wpautoterms last_updated_date="<slug>"] |
The date the page was last saved, in the date format and time zone the site uses |
Without a slug, each variant picks a page from where the shortcode sits.
| Where the shortcode sits | Page it uses |
|---|---|
| An Update Notices message | The first updated legal page of that message |
The content of a page embedded with page |
The embedded legal page |
| Anywhere else | The current post or page, of any type |
[wpautoterms page_link] in a blog post prints the address of that blog post, so name the slug to point at a legal page.
<p>Read our <a href="[wpautoterms page_link='privacy-policy']">[wpautoterms page_title='privacy-policy']</a>, last updated on [wpautoterms last_updated_date='privacy-policy'].</p>
Shortcodes for Update Notices messages only
[wpautoterms page_titles] and [wpautoterms page_links] list every page of an Update Notices message, and print nothing anywhere else. Use them in the "Message for multiple updated pages" field.
| Shortcode | Prints |
|---|---|
[wpautoterms page_titles] |
The titles of the updated pages, joined as "A, B and C" |
[wpautoterms page_links] |
The titles of the updated pages, each linked to its permalink, joined the same way |
The Update Notices kit fills that field with "Our [wpautoterms page_links] have been updated on [wpautoterms last_updated_date]." by default. Write the single-page and multiple-page messages with Announce Legal Page Updates in WordPress.
Rules every legal page shortcode follows
An empty or unexpected result from a legal page variant comes from one of these rules.
- Only published legal pages are found. A draft, a private page, or a page in the Trash makes the shortcode print nothing.
- A slug that matches nothing prints nothing. An empty slug gives the same empty result.
- A top-level page comes before a child page with the same slug. Among child pages with the same slug under different parents, the shortcode uses the newest, and a
parent/childpath names a child page exactly. - Dates follow the site settings. The format and the time zone come from Settings > General. The month names follow the site language, so an English legal page on a French site shows a French month.
- Country and state names are English. They stay English on a site in any language.
- Double brackets print the shortcode as text.
[[wpautoterms site_name]]shows[wpautoterms site_name]on the page, which is how to quote a shortcode.
A slug changes only when you edit it, or when WordPress numbers a duplicate on publish. Check the slug each generated page receives in Create a Privacy Policy in WordPress.
Where the wpautoterms shortcode runs
The [wpautoterms] shortcode runs wherever WordPress or the plugin expands shortcodes in text. WordPress expands it in post, page, and legal page content, and the plugin expands it in the messages of the Cookie Notice, Update Notices of Legal Pages, and Endorsements kits.
Each message editor shows "Insert shortcode:" links for the variants it supports. Write the Cookie Notice message with Add a Cookie Notice Bar to WordPress.
WordPress expands [wpautoterms] in a Text widget and in a Shortcode block of a widget area. Menu labels, Navigation block labels, and post titles show the shortcode as plain text, unless your WordPress theme or another plugin expands it there.
Legacy shortcodes from "Auto Terms of Service and Privacy Policy" 1.x
The AutoTerms plugin keeps the 3 shortcodes of the 1.x plugin "Auto Terms of Service and Privacy Policy". They print the fixed English text of version 1.x, filled with your details.
| Shortcode | Prints |
|---|---|
[my_terms_of_service_and_privacy_policy] |
A contents list, the Terms of Service, and the Privacy Policy |
[my_terms_of_service] |
The Terms of Service |
[my_privacy_policy] |
The Privacy Policy |
The legacy text appears only while the "On/Off" select on the TermsFeed > Legacy Auto TOS & PP screen reads "On / Displaying". The select stays disabled at "Off / Coming soon" while any field except DMCA Notice URL is empty.
- Open TermsFeed > Legacy Auto TOS & PP and fill in every field except DMCA Notice URL, from TOS Heading to Arbitration Location.
- Choose "On / Displaying" in the "On/Off" select.
- Click the "Save Changes" button.
Until you save the screen with "On / Displaying", the shortcodes print a placeholder, such as "Privacy Policy is coming soon.". The Legacy Auto TOS & PP menu item appears only on sites upgraded from 1.x. On any other site the legacy shortcodes print the placeholder only, so embed a legal page with [wpautoterms page="<slug>"] instead. Add text before or after the legacy headings with the legacy filters in TermsFeed AutoTerms Action Hooks and Filters.