How to Upgrade Articles Anywhere from Joomla 3 to Joomla 4

Articles Anywhere has a single package that works on both Joomla 3 and Joomla 4. The correct files will be installed from the same package depending on which version of Joomla you're using.

We have separate Documentation pages for the J3 and J4 versions of Articles Anywhere. You can switch to the desired J3/J4 documentation by using the version selection at the top of this site.

This is the process to upgrade any of the Regular Labs Extensions:

  1. First, make sure that your Joomla 3 site is updated to the latest Joomla 3.10 release
  2. On Joomla 3.10, update all the installed Regular Labs Extensions to their latest version
  3. Upgrade your Joomla 3.10 site to Joomla 4
  4. Upgrade the PHP version on your server to PHP 8.1 or higher
  5. Reinstall the latest versions of all the Regular Labs extensions. This will upgrade the extensions to their Joomla 4 counterpart.

Migrating Old J3 Syntaxes to New J4 Syntaxes

The Joomla 4 version of Articles Anywhere is a complete revamp of the extension, so it comes with a lot of breaking changes. Many syntaxes have changed compared to the Joomla 3 version, check the dedicated article for all the details on what's new and what changed.

Below you find a tutorial on how to update the Data Tags syntaxes that have been changed between the Joomla 3 and Joomla 4 versions of Articles Anywhere.

How to make the Replacements

You essentially have two options on how to update the J3 syntaxes to J4 syntaxes: the long way, and the short way.

In the tutorial below, we're going to use our extension DB Replacer Pro to easily make the replacements. If you're not familiar with it, we strongly suggest you first read the DB Replacer documentation.

Make a Backup of your Database before starting!

With DB Replacer, the replacements are done permanently in the database in the places you tell it to. This means that if you make a mistake, you can potentially break your site.

So make sure you take backups of your Database first, so that you can always go back to it in case something goes wrong.

We cannot accept any liability for lost data if something goes wrong in your site.

As explained in the DB Replacer documentation, when navigating to the component's view in the administrator, you can select a database table and the desired table column(s) where to make the replacements. You can then input a search and replace string and confirm.

DB Replacer gives you a preview of what is going to be replaced, so you can see what will happen before actually replacing anything.

Where to make the Replacements

With DB Replacer, you can only search and replace in one table at a time (but you can select multiple columns for each). So you will need to perform these replacements in all database tables where you use Articles Anywhere. The common places where Articles Anywhere might be used are:

  • Articles Text
  • Category Description
  • Custom Modules
  • Custom Fields
  • Snippets

So these are some of the tables and column(s) where you might need to make the replacements, depending on your use:

TableColumns
content introtext, fulltext
categories description
modules content
fields_values value
snippets content

Of course, you don't need to make all the replacements in certain tables if you weren't using Articles Anywhere in those. You only have to make the replacements in the tables you were actually using. So you might need just the Content (Articles) table in your case.

There could be other places where you use Articles Anywhere. In that case, identify the respective database tables and columns and make the replacements there too.

Enable Regular Expressions

All of the replacements below are going to make use of Regular Expressions. So make sure you tick the Regular Expression checkbox when running these replacements.

DB Replacer - Regular Expressions

List of Replacements

Below, we're going to give you all the search and replace strings you need to migrate from Joomla 3 syntaxes to Joomla 4 syntaxes.

Of course, you don't need to make all the replacements if you weren't using certain syntaxes/features in your site. You only have to make the replacements for the syntaxes you were actually using.

Note: These replacements instructions are all based on assuming you're using the default Tag Syntax of Articles Anywhere. If you've changed the Tag Syntax to something else on your site, you will need to tweak the search and replace inputs, or the replacements will not work.

Note: The "Backwards Compatible" message indicates whether the old syntax from Joomla 3 will or will not work on Joomla 4. Either way, we suggest migrating to the new syntaxes even in cases where the old one is still supported.

LAST WARNING: handle with care, take backups first, and make sure you know what you're doing.

Short Syntax to Attribute Syntax

BACKWARDS COMPATIBLE: NO

The short syntax to pick a Single Article without attributes is no longer supported in the Joomla 4 version. You should instead use the syntax with the proper attribute (title, alias, or id).

IMPORTANT: You should perform the following three replacements in this exact order reported below:

1 ID Variant

The following Regular Expression will help you migrate from {article 123}...{/article} to {article id="123"}...{/article}:

Search:
(\{article(?:-[a-z0-9-_]+)?) ([0-9]+)\}
Replace:
\1 id="\2"}

2 Alias Variant

The following Regular Expression will help you migrate from {article fox-terrier}...{/article} to {article alias="fox-terrier"}...{/article}:

Search:
(\{article(?:-[a-z0-9-_]+)?) ([a-zA-Z0-9-_]+)\}
Replace:
\1 alias="\2"}

3 Title Variant

The following Regular Expression will help you migrate from {article Fox Terrier}...{/article} to {article title="Fox Terrier"}...{/article}:

Search:
(\{article(?:-[a-z0-9-_]+)?) ([^\}"]+)\}
Replace:
\1 title="\2"}

Out with Underscores, in with Dashes

BACKWARDS COMPATIBLE: YES

All Data Tags or attributes that previously included underscores (_), have now been changed to use dashes (-) instead. This is so the syntax is consistent across all Data Tags.

So, for example, you should use publish-up instead of publish_up. You should use include-child-categories instead of include_child_categories. This applies to all cases.

The following Regular Expressions will help you migrate from the old syntax to the new one, across Filters, Data Tags and If Structures:

Filters, Ordering & If Structures

IMPORTANT: You will probably need to run this replacement multiple times, until all tags are found and replaced.

Search:
(\{(?:article|if|elseif)[^\}]*?)(publish_(?:up|down)|one_per_category|include_child_categories|created_by(?:_alias)?|modified_by|ignore_(?:access|state|language)|offset_headings|category_|image_(intro|fulltext|[0-9]+|random|category)|is_(?:published|featured|first|last|even|uneven)|has_(?:access|next|previous)|per_page|page_param|(?:previous|next)_page|every_|is_[0-9]+_of_[0-9]+|(?:is|has)_(?:first|last|next|previous)_page|(?:total|count|previous|next)_no_(?:limit|pagination)|auto_titles)
Replace:
\1[[replace from="_" to="-"]]\2[[/replace]]

Data Tags

Search:
(\[/?(?:publish_(?:up|down)|one_per_category|include_child_categories|created_by(?:_alias)?|modified_by|ignore_(?:access|state|language)|offset_headings|category_|image_(intro|fulltext|[0-9]+|random|category)|is_(?:published|featured|first|last|even|uneven)|has_(?:access|next|previous)|per_page|page_param|(?:previous|next)_page|every_|is_[0-9]+_of_[0-9]+|(?:is|has)_(?:first|last|next|previous)_page|(?:total|count|previous|next)_no_(?:limit|pagination)|auto_titles))
Replace:
[[replace from="_" to="-"]]\1[[/replace]]

New Data Type Prefix

BACKWARDS COMPATIBLE: NO

To output Data Tags from the category, author, modifier, images, and videos, there is now a consistent syntax with a dedicated prefix.

The prefix is :, meaning all Category data is prefixed with category: instead of category-, Author data is prefixed with author: instead of author-, and so on. So for example, the syntax for category-title has now changed to category:title.

The following Regular Expressions will help you migrate from the old syntax to the new one, across Filters, Data Tags and If Structures:

Filters, Ordering & If Structures

IMPORTANT: You will probably need to run this replacement multiple times, until all tags are found and replaced.

Search:
(\{(?:article|if|elseif)[^\}]*?(?:category|parent-category|author|modifier|image-(?:intro|fulltext|[0-9]+|random|category)|category-image|youtube-(?:[0-9]+|random)|vimeo-[0-9]+))-
Replace:
\1:

Data Tags

Search:
(\[/?(?:category|parent-category|author|modifier|image-(?:intro|fulltext|[0-9]+|random|category)|category-image|youtube-(?:[0-9]+|random)|vimeo-[0-9]+))-
Replace:
\1:

Text Options Changes

Limit text by characters

BACKWARDS COMPATIBLE: YES

The following Regular Expression will help you migrate from [text limit="100"] to[text characters="100"]:

Search:
(\[(?:text|introtext|fulltext|title|metakey|metadesc)(?: [^\]]+)?) limit="([0-9]+)"
Replace:
\1 characters="\2"

Strip HTML tags from text

BACKWARDS COMPATIBLE: NO

The following Regular Expression will help you migrate from [text strip="true"] to [text html="false"]:

Search:
(\[(?:text|introtext|fulltext|title|metakey|metadesc)(?: [^\]]+)?) strip="true"
Replace:
\1 html="false"

Strip images from text

BACKWARDS COMPATIBLE: NO

The following Regular Expression will help you migrate from [text noimages="true"] to [text images="false"]:

Search:
(\[(?:text|introtext|fulltext|title|metakey|metadesc)(?: [^\]]+)?) noimages="true"
Replace:
\1 images="false"

Tags Changes

Output Tags as plain links

BACKWARDS COMPATIBLE: NO

The following Regular Expression will help you migrate from [tags clean="true"] to [tags layout="false"]:

Search:
(\[tags(?: [^\]]+)?) clean="true"
Replace:
\1 layout="false"

Output Tags as plain text (no links)

BACKWARDS COMPATIBLE: NO

The following Regular Expression will help you migrate from [tags strip="true"] to [tags links="false"] :

Search:
(\[tags(?: [^\]]+)?) strip="true"
Replace:
\1 links="false"

Filter where ALL values should match (eg. Should have BOTH specified tags)

BACKWARDS COMPATIBLE: YES

The following Regular Expression will help you migrate from {articles tags="Fluffy+Cuddly"} to {articles tags="Fluffy && Cuddly"}:

Search:
(\{(?:article|if|elseif)[^\}]*?) tags="([^"]+\+.*?)"
Replace:
 \1 tags="[[replace from="+" to=" && "]]\2[[/replace]]"

Custom Fields Changes

Custom Field With Label

BACKWARDS COMPATIBLE: NO

The following Regular Expression will help you migrate from [habitat-area label="true"] to [habitat-area showlabel="true"]:

Search:
(\[(?:[a-z0-9-_]+)(?: [^\]]+)?) label="true"
Replace:
\1 showlabel="true"

Custom Field Text Value

BACKWARDS COMPATIBLE: YES

The following Regular Expression will help you migrate from [habitat-area layout="false"] to [habitat-area:text]:

Search:
(\[(?:[a-z0-9-_]+))((?: [^\]]+)?) layout="false"
Replace:
\1:text\2

Custom Field Raw Value

BACKWARDS COMPATIBLE: YES

The following Regular Expression will help you migrate from [habitat-area output="value"] to [habitat-area:value]:

Search:
(\[(?:[a-z0-9-_]+))((?: [^\]]+)?) output=(?:'value'|"value"|'raw'|"raw"|"value"|"raw")
Replace:
\1:value\2

Only Custom Field Label

BACKWARDS COMPATIBLE: NO

The following Regular Expression will help you migrate from [habitat-area label="only"] to[habitat-area:label]:

Search:
(\[(?:[a-z0-9-_]+))((?: [^\]]+)?) label="only"
Replace:
\1:label\2

Value Layout

BACKWARDS COMPATIBLE: NO

The value_layout attribute to pass a PHP layout to custom fields values has been removed in favor of other methods:

  • If you were using it for List Fields, you should now switch to the new Foreach Structure.
  • If you were using it for Articles Field, you should now override the custom_html instead with: [habitat-area custom_html="..."]  once Articles Field becomes compatible for Joomla 4. See the dedicated guide page for this.

For complete instructions on how to use these features, check the dedicated part of the documentation.

Numbers Changes

The following Regular Expressions will help you migrate from first / last / even / uneven to is-first / is-last / is-even / is-uneven:

Data Tags

BACKWARDS COMPATIBLE: YES

Search:
(\[)((?:first|last|even|uneven|current)\])
Replace:
\1is-\2

If Structures

BACKWARDS COMPATIBLE: YES

Search:
(\{(?:if|elseif)[^\}]*?[ \!])((?:first|last|even|uneven|current)[ \}])
Replace:
\1is-\2

Calculations

BACKWARDS COMPATIBLE: NO

Calculations on numeric values are now made with a dedicated calc="..." attribute.

The following Regular Expression will help you migrate from [count+10] / [count*3] to [count calc="+10"] / [count calc="*3"]:

Search:
(\[(?:total|count|previous|next|limit|offset|per[-_]page|pages|page|previous[-_]page|next[-_]page|[a-z_-]+[-_]no[-_](?:limit|pagination)))([\+\-\*\/][0-9]+)
Replace:
\1 calc="\2"

K2 is no longer supported

Support for K2 was already limited in the Joomla 3 version of Articles Anywhere.

With the Joomla 4 version of Articles Anywhere, K2 is now not supported at all anymore.

K2 is an outdated component, that does not add much to the table anymore, now that Joomla supports Custom Fields out of the box. So if you're still using K2, our advice is to switch to Joomla core content (articles, categories, tags, custom fields).


See the full Articles Anywhere Documentation for Joomla 4 for more details on all these changes, and check out the Articles Anywhere J4 Features Blog Post for all the new additions introduced in the Joomla 4 version.