jQuery.load gives me a 404 Not Found in WPMU

2019-08-27 01:17发布

问题:

I've developed a plugin that works fine on a single site WP.
But when testing it on WPMU with subdomain, I get a 404 Not Found error.

The strange thing is that the content is loaded even though I get the error message - but the content is never displayed.

You can see a screenshot here:
http://www.stiengenterprises.com/download/tmp/jQuery_load_error.png

The jQuery code looks like this:

  jQuery.post("/wp-content/plugins/wp-eventcal/eventcal_jquery.php", { instance: 'getEvent', eventID: eventID },
  function(event)
  {
    alert(event); // For testing - never fires

  }, "json");

Any suggestions to how I can fix this?

.htaccess

# 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).*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# END WordPress

回答1:

This problem happens because your eventcal_jquery.php is not included to the Wordpress framework, so when it called, wp returns 404. Just include header('HTTP/1.1 200 OK'); after including wp-blog-header.php in your eventcal_jquery.php