themosis / framework

The Themosis framework core.
https://framework.themosis.com/
GNU General Public License v2.0
671 stars 121 forks source link

Multisite subdirectories and metaboxes, error on wp-api #777

Open robbertrosario opened 4 years ago

robbertrosario commented 4 years ago

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 commented 4 years ago

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.

jlambe commented 4 years ago

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.