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.
Where your answers equal General Settings or are left blank, generated legal pages print the website name and the website URL through [wpautoterms site_name] and [wpautoterms site_url]. They always print the last updated date through [wpautoterms last_updated_date]. The first 2 carry a change in General Settings to the pages that already exist. The 3 legacy shortcodes of the 1.x plugin work beside them.
Website and company details shortcodes
The website and company details variants print a value from TermsFeed > Settings. A change to the setting reaches every page that prints the value once your page cache is cleared. General Settings shows the shortcode under each field that has one, such as "Shortcode: [wpautoterms site_name]". Set the values these shortcodes print with WordPress Legal Page Settings. Each of these shortcodes prints one setting.
| 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. Use it to show your Privacy Policy inside a regular WordPress page, for example a page your WordPress theme already links from its footer.
Copy the shortcode of a published page from the Shortcode column of TermsFeed > All Legal Pages. The column shows a child page by its path, parent/child, which the shortcode accepts as written.
[wpautoterms page="privacy-policy"]
[wpautoterms page="policies/privacy-policy"]
WordPress formats the embedded page as it formats the content of a post. These rules decide what the page shortcode embeds and where.
- 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 print the title, the web address, or the date a legal page last changed. Each takes an optional slug, and with one it uses 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 therefore prints the address of that blog post. Name the slug to point at a legal page from anywhere.
<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. Both shortcodes belong in the "Message for multiple updated pages" field, which announces several pages changed on the same date.
| 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
The legal page variants find a page by its slug at display time. An empty or unexpected result 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, and the month names follow the site language.
- 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.
The plugin never renames a slug, so 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 that add the variants it supports. The Cookie Notice offers the 6 website and company details, the Endorsements disclaimer offers the same list without the state, and the Update Notices messages offer the legal page variants. Write the Cookie Notice message with Add a Cookie Notice Bar to WordPress. Set up the disclaimer with Add an Affiliate Disclosure in 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", so pages built with them keep working after the update. The legacy text is the fixed English text of version 1.x, filled with your details, and the questionnaires play no part in it.
Pick the legacy shortcode that prints the part of that text your page needs.
| 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, so fill the fields first.
- 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 "Terms and Privacy Policy are coming soon." or "Privacy Policy is coming soon.", instead. On a site upgraded from 1.x, users with access to the settings see a "Configure this plugin's settings." link after the placeholder. The link opens the Legacy Auto TOS & PP screen.
The Legacy Auto TOS & PP menu item appears only on sites upgraded from 1.x, where the old settings existed. On any other site the 3 legacy shortcodes print the placeholder sentence only, and [wpautoterms page="<slug>"] embeds a legal page created from the questionnaire instead. Add text before or after the legacy headings with the legacy filters in TermsFeed AutoTerms Action Hooks and Filters.