Omnalingo exposes WordPress filters and actions for developers, all namespaced
under omnalingo/…. Use them with add_filter() and add_action() as usual.
// Add a CSS selector to the translation exclusion list
Return false to skip translated search for a query — or for the whole site.
omnalingo/search/rest_routes
filter
($patterns)
Regex patterns for the REST routes translated search may widen. Defaults to WooCommerce’s Store API products route; core’s /wp/v2/ routes are never widened.
Whether newly listed content starts with automatic translation on. See Automatic translation for new content. Since 0.9.4; also runs for archives and added addresses since 0.9.7.
omnalingo/front_page_id
filter
($id)
The post ID of the site’s front page (0 = latest posts). For themes that choose the front page themselves; Omnalingo’s Enfold integration uses it. Since 0.9.4.
Every page in Omnalingo’s list has its own Auto-translate switch. A page gets its switch when
Omnalingo first lists it, usually the moment it is published, and it starts with the site-wide
default. The Enable Auto translate for all button above the content list in Translate sets that
default to on (and switches every listed page on); Turn off for all in the same button’s menu sets
it to off.
omnalingo/auto_translate/new_content lets you decide per page instead. Return true to start the
page with automatic translation on, false to start it off, or $enabled to keep the site-wide default.
Argument
Example
Meaning
$enabled
false
The site-wide default for new content.
$objectId
2915
Post ID, or term ID for categories and tags. For archives: 202611 (year and month) for a monthly archive, the author’s user ID for an author archive, a number derived from the post type for a post-type archive. 0 for an address added by hand or from the live editor.
$objectType
'post'
'post', 'term', 'archive' (since 0.9.7) or 'custom' (an added address, since 0.9.7).
$contentType
'ex_team'
Post type or taxonomy, such as 'page', 'product' or 'product_cat'. For archives 'date_archive', 'author_archive' or 'cpt_archive'; 'custom' for added addresses.
Check $objectType before you use $objectId: for an archive it is not a post ID, and an author’s
user ID can match an unrelated post.
| $url | '/member/maria-papadopoulou/' | The address in the site’s main language, relative to the site root. |
Example: leave the site-wide default off, and translate new author biographies (the ex_team post
type, or anything under /member/) automatically:
It runs once per page, when Omnalingo first lists it. Later saves don’t run it again, so a switch
you change by hand on the page keeps your choice.
Pages already in the list are not touched. To switch existing pages on, select them in the
Translate list and turn Auto-translate on there.
Later edits are covered. A page with Auto-translate on is read again after each save, and new or
changed text is translated automatically.
What it does not cover. The 404 and search-results entries and shop email previews always start
off; Omnalingo creates them by itself. A draft or private post added from the live editor starts off
too.
The content type must be tracked. Omnalingo only lists the content types selected in its
content settings; make sure the post type (here ex_team) is one of them.
Return a real boolean. Any other value is converted with PHP’s (bool).