senlin / lean-wp

March 31, 2020: No longer in active development, use at own risk
GNU General Public License v3.0
29 stars 4 forks source link

XML/RPC #15

Closed ghost closed 4 years ago

ghost commented 5 years ago

great plugin! I love it.

Is there a way to leave XML-RPC enabled or to re-enable it in code from another plugin or functions.php?

I use WP/LR Sync plugin to manage images in some of the websites; I really can't give up on that. https://meowapps.com/wplr-sync-xmlrpc-related-issues/

senlin commented 5 years ago

@mikele3 thanks or your message.

I am not sure if it works to add the filter where Lean WP disables the function back in?

In https://github.com/senlin/lean-wp/blob/master/includes/class-lean-wp.php#L93-L96:

// Disable XML-RPC - //plugins.svn.wordpress.org/disable-xml-rpc/tags/1.0.1/disable-xml-rpc.php
add_filter( 'xmlrpc_enabled', '__return_false' );
// Remove call for XML-RPC from HEAD - @ZenPress //wordpress.stackexchange.com/questions/219643/best-way-to-eliminate-xmlrpc-php#comment350490_219666
add_filter( 'pings_open', '__return_false', PHP_INT_MAX );

Perhaps add a function that triggers later and adds XML-RPC back in?

If that doesn't work, then I will have to add something that you can enable it again, which could either be a settings page or a pluggable function.

Please let me know if it works.

ghost commented 5 years ago

@senlin thank you for the quick reply and support.

As I was attempting to re-enable XML-PRC, I eventually realized WP/LR Sync doesn't use that method anymore, but the Rest API.

I tried adding this: remove_filter('rest_authentication_errors', 'lwp_disable_wp_rest_api', PHP_INT_MAX); to a mu-plugin I wrote for that site, but with no success.

I resorted to commenting out : require_once( 'includes/lib/class-lean-wp-disable-rest-api.php' ); https://github.com/senlin/lean-wp/blob/master/lean-wp.php#L38

is there a cleaner way to re-enable the Rest API?

senlin commented 5 years ago

Glad you found a solution, albeit very temporary @mikele3

is there a cleaner way to re-enable the Rest API?

There could be, but that would involve rewriting the plugin either placing the required files in an init action or by adding a settings page. The latter I have been contemplating, but if I go that way, it will most definitely be a premium version of the plugin.

ghost commented 5 years ago

I guess I wouldn't mind paying for it. The mu-plugin I mentioned earlier is one that I wrote myself already years ago to do part of what now "Lean WP" does better.

Another plugin I use that relies on the Rest API for some of its functionality is "Contact Form 7"