So I encountered this quite weird bug:

  1. Go to Dashboard > Network > Sites > Add New
  2. Add new site

Instead of successfully adding new site, WordPress kept showing me this Are you sure you want to do this? message.

After investigating it, I realize that WordPress checks whether the incoming request comes from the correct site. The problem is, the DOMAIN_CURRENT_SITE constant defined on wp-config.php is mysite.com while the current address is www.mysite.com with www. modified through .htaccess (we got this quite issue for this site since it is a migration from the previous CMS and we want to keep the exact same address).

Knowing the scope of the problem and the circumstances (this happens to a WordPress multisite install where only super admin is able to create a site) the fix becomes quite clear:

  1. We have to keep the www.
  2. We have to add new site which will not become a frequent activity
  3. Delete (or mark as comment, both will do) the line on the .htaccess which force the URL to have a www..
  4. Refresh the Dashboard > Network > Sites > Add New
  5. Add New Site
  6. Check the newly created new site
  7. Put back the line on the .htaccess which force the URL to have a www.

In my case, this will do the work.

The deduction steps

For those who are interested in how I came accross this solution, these are the deduction steps:

  1. Check the file used on the on the page /wp-admin/network/site-new.php
  2. Try to search the error message or any ID or DOM through the WordPress installation. I often copy the error message / ID or any part of the printed DOM using Sublime Text 2’s CMD + Shift + F (Just make sure you have added the WordPress folder to the Sublime Text 2)
  3. The clue for this error is check_admin_referer() displayed on /wp-admin/network/site-new.php which is defined on /wp-includes/pluggable.php and wp_nonce_ays() which is defined on /wp-includes/functions.php

Share Your Thought