I would like to activate the extension VisualEditor by default to all available and future Namespaces by default in MediaWiki. In particular see section Changing active namespaces of the VisualEditor extension page mentioned above.

This means that I would like to (if possible):

  • avoid having to modify LocalSettings.php after having added a Namespace;
  • avoid having to modify source code in MediaWiki itself;
  • avoid having to modify source code in MediaWiki Extensions (namely VisualEditor).

I saw that there has already been attempts in doing this here but it didn't work when I tried the suggested modification and it violated my rule of wanting to avoid modifying any source code (see bullet points above).

I was thinking about something like this in LocalSettings.php (based on section Changing active namespaces mentioned above):

$wgVisualEditorAvailableNamespaces = [
    * => true

Any ideas/suggestions?

1 Answer 1


The idea is to use the namespace id in your LocalSettings.php. As a consequence, you can configure your future namespaces in advance. When you will create your next namespace, it will be already configured. Please find below an example:

for ($x = 3000; $x <= 4000; $x++) {
    $egApprovedRevsEnabledNamespaces[$x] = true;
    $wgVisualEditorAvailableNamespaces[$x] = true;

I have tested and it worked. See you soon Pit ;)

  • ... and of course you can give a real name to your namespace i.e "My Namespace". In the LocalSettings.php we are using the index of the namespaces array.
    – C. Laziosi
    Commented Sep 25, 2019 at 19:43
  • This is not working for me.
    – Max N
    Commented Jun 26, 2023 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.