framework icon indicating copy to clipboard operation
framework copied to clipboard

Multisite subdirectories and metaboxes, error on wp-api

Open robbertrosario opened this issue 4 years ago • 2 comments

  • Themosis Version: 2.0.5
  • WordPress Version: 5.4.1
  • PHP Version: 7.3.16

Description

I have a multisite with subdirectories and metaboxes, but the fields do not show. I have tested and this is not a problem on a single site.

domain.com/wp-api/themosis/v1/metabox/properties?post_id=1 => 200 domain.com/subsite/wp-api/themosis/v1/metabox/properties?post_id=1 => 404

Wordpress is unable to reach the api on a subsite, which causes themosis.core.js to fail with: Error: Request failed with status code 404

I am using the wp recommended apache rules for multisite subdirectories and have looked into everything that was said here: #225 but as all the other routes work, this leds me to believe it might be an issue within themosis?

robbertrosario avatar May 12 '20 05:05 robbertrosario

Update: the options show when I override it from the my web.php file:

Route::group([
    'middleware' => 'api',
    'prefix' => '/subsite/wp-api/themosis/v1',
    'namespace' => '\Themosis\Metabox\Controllers'
], function () {
    Route::apiResource('metabox', '\Themosis\Metabox\Controllers\MetaboxApiController')->only(['show', 'update']);
});

However, the PUT request still throws a 500. I am wondering if this was build for subdirectory multisites.

robbertrosario avatar May 13 '20 15:05 robbertrosario

Perhaps you would like to fix the "sites" URL for your application by updating the returned values found inside the app/Hooks/Application.php file.

It's generally defined to handle single and subdomain multisite installation but not subdirectories.

jlambe avatar May 15 '20 16:05 jlambe