Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

pt:Administração de Rede Multissitios


Once you've created a Multisite Network, there are some additional things you might need to know about advanced administration, due to the additional complexity of a Multisite. Even if you're familiar with WordPress, the location and behavior of Multisite Network Administration can be confusing.

Acesso de Utilizador

By design, all users who are added to your network will have subscriber access to all sites on your network. To allocate a different default role for users on individual sites, you must use a plugin, such as Multisite User Management.

The capabilities of the site administrator role are also reduced in a WordPress Network. Site admins cannot install new themes or plugins and cannot edit the profiles of users on their site. Only the Network Admin (aka Super Admin) has the ability to perform these tasks in a WordPress network.

Instalação de Subpasta e Hiperligação Permanente

While permalinks will continue to work, the main site (i.e. the first one created) will have an extra entry of blog, making your URLs appear like domain.com/blog/YYYY/MM/POSTNAME.

This is by design, in order to prevent collisions with SubFolder installs. Currently there is no easy way to change it, as doing so prevents WordPress from auto-detecting collisions between your main site and any subsites. This will be addressed, and customizable, in a future version of WordPress.

Also note that the blog prefix is not used for static pages which will be accessible directly under the base address, e.g. domain.com/PAGENAME. If you try to create a static page in the first site with the name of another existing site on the network, the page's permalink will get a suffix (e.g. domain.com/PAGENAME-2). If you create a new site with the slug of an existing static page, the static page will not be reachable anymore. To prevent this, you can add the names of your static pages to the blacklist so that no site with that name can be created.

Caminho de Ficheiro Enviado

Your first site on a fresh install will put uploaded files in the traditional location of /wp-content/uploads/, however all subsequent sites on your network will be in the /wp-content/uploads/sites/ folder, in their own subfolder based on the site number, designated by the database. These files will be accessible via that URL.

This is a change from Multisite 3.0-3.4.2, where images of subsites were stored in /wp-content/blogs.dir/ and were shown in http://example.com/files/ and http://example.com/sitename/files and so on. If you started with a Multisite install older than 3.5, it is not an error if your images show with the URL of /files/.

Regardless of WP version, these locations cannot be changed by site admins. Only the network admin can make changes on the site settings page. It is not recommended that you change these without understanding how both the ms-files.php works in conjunction with your .htaccess, as it can easily become non-functional. If the /files/ urls aren't working, it's indicative of a misconfigured .htaccess or httpd.conf file on your server.

Plug-ins

Plugins now have additional flexibility, depending upon their implementation across the network. All plugins are installed on the network dashboard's plugin page, and can be activated per-site or for the entire network.

  • Site Specific Plugins: WordPress Plugins to be activated or deactivated by an individual site admin are stored in the plugins directory. You need to enable the Plugins page for individual site administrators from the Network Admin's Settings -> Network Settings menu. Specific site administrators can then toggle optional plugin activation.
  • Network Plugins: WordPress Plugins that are also stored in the plugins directory can be activated across the entire network by the super admin. Once 'Network Activated' plugins will become active in all sites. 'Network Activated' plugins are hidden entirely from per-site plugin lists.
  • Must-Use Plugins: Plugins to be used by all sites on the entire network may also be installed in the mu-plugins directory as single files, or a file to include a subfolder. Any files within a folder will not be read. These files are not activated or deactivated; if they exist, they are used. These plugins are hidden entirely from per-site plugin lists.

Temas

All themes are installed for the entire network. If you edit the code of one theme, you edit it for all sites using that theme. You can install the plugin WordPress.com Custom CSS to allow each site to tweak their own CSS without affecting anyone else. You can activate themes for the entire network, or edit sites and activate them individually.

By default, WordPress assigns the most recent "Twenty ..." as the theme for all new sites. This can be customized by adding a line like define('WP_DEFAULT_THEME', 'classic'); to your wp-config.php file, where 'classic' is replaced with the folder name of your theme.

Categorias e Etiquetas

Global terms (i.e. sharing tags and categories between sites on the network) is not available in WordPress 3.0. You can use the Sitewide Tags WordPress Plugin or other similar Plugins to incorporate global tags on the portal/front page of the site or on specific pages or sites within the network to increase navigation based upon micro-categorized content.

Mudança de tipos de rede

It's possible to switch between domain-based (sub-domain) and path-based (sub-directory) installations of Multisite. If you have had WordPress installed for longer than a month and are attempting to activate the network, you will be told to use Sub-domain sites. This is in order to ensure you don't have conflicts between pages (i.e. example.com/pagename ) and sites (i.e. example.com/sitename ). If you are confident you will not have this issue, then you can change this after you finish the initial setup.

In your wp-config.php file, you'll want to change the define call for SUBDOMAIN_INSTALL:

For a domain-based network (sub-domain install)
define( 'SUBDOMAIN_INSTALL', true );
For a path-based network (sub-directory install)
define( 'SUBDOMAIN_INSTALL', false );

You'll also have to change your .htaccess to the new setup.

Note that per the Settings Requirements you cannot switch from Sub-directory to Sub-domain when running on 127.0.0.1 or localhost. This can potentially cause an endless loop of reauth=1 on your root site due to cookie handling.

Hospedeiros Virtuais Apache e Reescrever Mod

To enable mod_rewrite to work within an Apache Virtual host you may need to set some options on the DocumentRoot.

<VirtualHost *:80>
  DocumentRoot /var/www/vhosts/wordpress
  <Directory /var/www/vhosts/wordpress>
    AllowOverride Fileinfo Options
  </Directory>

In some instances, you will need to add All to your AllowOverride for all htaccess rules to be honored.

.htaccess e Reescrever Mod

Unlike Single Site WordPress, which can work with "ugly" Permalinks and thus does not need Mod Rewrite, MultiSite requires its use to format URLs for your subsites. This necessitates the use of an .htaccess file, the format of which will be slightly different if you're using SubFolders or SubDomains. The examples below are the standard .htaccess entries for WordPress SubFolders and SubDomains, when WordPress is installed in the root folder of your website. If you have WordPress in its own folder, you will need to change the value for RewriteBase appropriately.

As a reminder, these are EXAMPLES and work in most, but not all, installs.

SubFolder Example

WordPress 3.0 through 3.4.2

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
# END WordPress

WordPress 3.5+ ONLY use this if you STARTED Multisite on 3.5. If you upgraded from 3.4 to 3.5, use the old one!

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

SubDomain Example

WordPress 3.0 through 3.4.2

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
# END WordPress

WordPress 3.5+

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ wp/$1 [L]
RewriteRule . index.php [L]

Problemas com a instalação de WPMU antigos

If you installed WordPress MU in subfolder/subdirectory (not in root folder on your server via ftp) and you have problem with image library, where thumbnails and images do not show, you may need to manually add in rewrite rules for your file directories as follows:

RewriteRule ^([_0-9a-zA-Z-]+/)?siteN/files/(.+) wp-content/blogs.dir/N/files/$2 [L]

Put those below the normal call for uploaded files.

Localização da Hiperligação de Administrador de Rede

The Network Admin Link has moved with each major release of WordPress, as this is still a work in progress. Depending on which version of WordPress you are using, the link can be found in the following locations:

  • 3.0 - A menu called Super Admin
  • 3.1 - On the admin header by "Howdy, YOURNAME."
  • 3.2 - On the admin header, as a drop-down under "Howdy, YOURNAME."
  • 3.3+ - On the admin bar, as a drop-down under your "My Sites"

Mover Multissítios

Moving Multisite is more complicated than moving a single install. Please read Moving WordPress Multisite before continuing.

Importação para uma Rede

When you've created your WordPress Network for importing other sites, you need to look at the Migrating Multiple Blogs into WordPress Multisite article.