Manual talk:$wgNamespacesToBeSearchedDefault

User preferences
Important to note that setting this will not override a users preferences. So if you have changed your preferences, changing this will not appear to you, making you think that it hasn't worked --Dr DBW 01:54, 27 June 2007 (UTC)

The above problem, unfortunately, applies even to namespaces created after a user was created/has edited his/her preferences. The problem is that method  in   does not fall back to default user options if a particular option does not exist in that user's preferences. This is quite annoying if you use namespaces to categorize article types since there is no easy way to update preferences of all users. The following implementation of  solves the problem - it uses default values for options which the user did not touch yet: --Jim Bim 18:32, 17 August 2007 (UTC)

Problem with line $this -> load
There seems to be a problem in line 2:

no method "load" known

probably the correct code is:   ?

Custom namespaces
I think this setting needs to be included after any custom namespace declarations in LocalSettings.php or it won't take effect.  Thorncrag    01:48, 26 January 2011 (UTC)


 * Not strictly speaking, but if you're defining constants for the namespaces, you can't use them until you've defined them! —Emufarmers(T 03:15, 26 January 2011 (UTC)

Namespaces must be uppercase?
Namespaces must be uppercase? Because, I put this in LocalSettings.php:

But it didn´t work. What is the mistake? --Speedtook 09:25, 26 January 2012 (UTC)


 * I guess you have to set an entirely new array in LocalSettings.php including all namespaces and yes I would follow the example an capitalise the names of the namespaces. Cheers --&#91;&#91;kgh&#93;&#93; 14:30, 26 January 2012 (UTC)
 * Yes the namespace constants (NS_MAIN NS_HELP, etc) must be all uppercase. Bawolff 15:38, 26 January 2012 (UTC)
 * Oops, indeed capitalise is not the same as uppercase. :| Cheers --&#91;&#91;kgh&#93;&#93; 20:05, 26 January 2012 (UTC)

Im getting an error...
Notice: Use of undefined constant NS_SITE - assumed 'NS_SITE' in Z:\wamp\www\w\LocalSettings.php on line 436 Call Stack

The code:


 * 1) Namespace sites begin

$wgExtraNamespaces[700] = "Site"; $wgExtraNamespaces[700] = "Site_talk"; $wgContentNamespaces[] = 700;
 * end


 * 1) Namespace people begin

$wgExtraNamespaces[800] = "People"; $wgExtraNamespaces[801] = "People_talk"; $wgExtraNamespaces[800] = "Site_talk";


 * end

$wgNamespacesToBeSearchedDefault = array(       NS_MAIN =>           true,        NS_TALK =>           false,        NS_USER =>           true,        NS_USER_TALK =>      false,        NS_PROJECT =>        true,        NS_PROJECT_TALK =>   false,        NS_IMAGE =>          true,        NS_IMAGE_TALK =>     false,        NS_MEDIAWIKI =>      false,        NS_MEDIAWIKI_TALK => false,        NS_TEMPLATE =>       false,        NS_TEMPLATE_TALK =>  false,        NS_HELP =>           true,        NS_HELP_TALK =>      false,        NS_CATEGORY =>       true,        NS_CATEGORY_TALK =>  false );
 * 1) Set default searching
 * end

--Muqman 52 (talk) 21:26, 31 May 2012 (UTC)


 * Probably you should set the extra Namespaces as advised $wgExtraNamespaces. Cheers --&#91;&#91;kgh&#93;&#93; (talk) 07:59, 29 June 2013 (UTC)

Change in MW1.34
Before 1.34, having this set to 		NS_IMAGE =>         true, NS_IMAGE_TALK =>    false, worked. After 1.34, these throw an error [21-Dec-2019 10:09:57 America/Winnipeg] PHP Warning: Use of undefined constant NS_IMAGE - assumed 'NS_IMAGE' (this will throw an Error in a future version of PHP) in /home/xxx/wiki.xxx.ca/LocalSettings.php on line 98

Solution is to use NS_FILE and NS_FILE_TALK instead. Thanks to Sam Reed for the answer. Tenbergen (talk) 16:52, 21 December 2019 (UTC)

Remark regarding changes for existing users
See https://www.mediawiki.org/wiki/Topic:Vkhl3smzar03240e. Fixed now. --Wikinaut (talk) 18:06, 14 April 2020 (UTC)