multisite-global-media
multisite-global-media copied to clipboard
When this plugin is active then there is an issue with the Elementor WordPress plugin
It seems that that once activating the Multisie Global Media plugin then the "Edit with Elementor" fuction does not work, so pages can not be adited in front end easy way. Every time that I want to edit the Homepage with Elementor, I first need to deactivate this plugin.
@Roioo7 Could you kindly give us some more context and if it's possible a copy/paste of the console output?
It's possible to open the console in chrome by mouse with right click
+ Inspect
then click on Console
tab.
Hello dear team,
Attached to this email is the video of the error. When the Multisite Global Media plugin is activated, then I can not edit my pages by using the Elementor plugin - the elementor would not load the "Edit with Elementor" page.
Thank you
Best Regards, Royi
@widoz I am having the same issue using Elementor 3.0.11, Multisite Global Media 0.1.1 and Wordpress 5.5.1.
If I disable Multisite Global Media, I am able to edit pages with Elementor. This is what I see on the console when it is enabled:
Failed to load resource: the server responded with a status of 500 (Internal Server Error) /wp-json/elementor/v1/globals:1
Fatal error: Uncaught Error: Cannot use object of type Closure as array in /var/www/clients/client3/web7/web/wordpress/wp-content/plugins/multisite-global-media/src/Rest/Rest.php:76 Stack trace: #0 /var/www/clients/client3/web7/web/wordpress/wp-includes/class-wp-hook.php(287): MultisiteGlobalMedia\Rest\Rest->restRequestAfterCallbacks(Object(WP_Error), Array, Object(WP_REST_Request)) #1 /var/www/clients/client3/web7/web/wordpress/wp-includes/plugin.php(206): WP_Hook->apply_filters(Object(WP_Error), Array) #2 /var/www/clients/client3/web7/web/wordpress/wp-includes/rest-api/class-wp-rest-server.php(1074): apply_filters('rest_request_af...', Object(WP_Error), Array, Object(WP_REST_Request)) #3 /var/www/clients/client3/web7/web/wordpress/wp-includes/rest-api/class-wp-rest-server.php(376): WP_REST_Server->dispatch(Object(WP_REST_Request)) #4 /var/www/clients/client3/web7/web/wordpress/wp-includes/rest-api.php(339): WP_REST_Server->serve_request('/elementor/v1/g...') #5 /var/www/clients/client3/web7/web/wordpress/wp-includes/cla in /var/www/clients/client3/web7/web/wordpress/wp-content/plugins/multisite-global-media/src/Rest/Rest.php on line 76
There has been a critical error on your website.
I hope this helps!
@kyushuadamu Thanks for reporting the Error output.
Based on your error the problem seems located at this line https://github.com/bueltge/multisite-global-media/blob/master/src/Rest/Rest.php#L76
!isset($handler['callback'][0]) || !($handler['callback'][0] instanceof WP_REST_Posts_Controller)
Where the $handler['callback'][0]
is expected to be $handler['callback']
because it's a callable
and not an array
.
I had a look at the WordPress code and based on the endpoints
initialization here https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-api/class-wp-rest-server.php#L95-L106 where the callback
entry is 'callback' => array( $this, 'get_index' )
obviously a callback.
I do not know why the plugin is looking for $handler['callback'][0]
, need to investigate since it's just used for the conditional and anything else.
cc @oxyc
Can't recall unfortunately and don't have access to test it at the moment.
There's quite a few plugins that does this too so I'm guessing it was just from inspecting what was given in the $handler
argument and writing a conditional for the particular case–without following docs on the filter.
I'll try to work on it this weekend. Basically what's need to be done is to add a proper condition to allow performing the action only for that specific context.
Same here. We are deactivating the plugin in the meantime, I hope you can come out with a solution, we are pretty happy with it otherwise.
I have made a little research and now it's clear the reason of having the condition (https://github.com/bueltge/multisite-global-media/blob/master/src/Rest/Rest.php#L76).
We want to ensure the REST API request is for Posts and perform the actions only in that case. I think therefore the PR made by @tecking 👉 https://github.com/bueltge/multisite-global-media/pull/121 make totally sense.