Last active
December 13, 2022 14:25
-
-
Save otakupahp/ae5ac700a0dc2ae782fb7b1e54d441c9 to your computer and use it in GitHub Desktop.
WP MU Misc Plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: OtakuPahp Security Measures | |
Description: Some Wordpress Hacks to improve site security | |
Author: Pablo Hernandez (OtakuPahp) | |
Author URI: https://otakupahp.llc | |
Version: 1.0.0 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly | |
} | |
/** | |
* Disable REST API user endpoints. | |
* | |
* @param array $endpoints The original endpoints. | |
* @return array The updated endpoints. | |
* @since 1.0.0 | |
*/ | |
function smntcs_rest_endpoints( $endpoints ) { | |
if ( isset( $endpoints['/wp/v2/users'] ) ) { | |
unset( $endpoints['/wp/v2/users'] ); | |
} | |
if ( isset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] ) ) { | |
unset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] ); | |
} | |
return $endpoints; | |
} | |
add_filter( 'rest_endpoints', 'smntcs_rest_endpoints' ); | |
/** | |
* If you want to deactivate XMLRPC.PHP copy the folowing code | |
* at the end of your .htaccess file | |
*/ | |
/* | |
# Block WordPress xmlrpc.php requests | |
<Files xmlrpc.php> | |
order deny,allow | |
deny from all | |
</Files> | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: OtakuPahp WC Hacks | |
* Description: Some WooCommerce Hacks | |
* Author: Pablo Hernandez (OtakuPahp) | |
* Author URI: https://otakupahp.llc | |
* Version: 1.0.0 | |
*/ | |
// Exit if accessed directly | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
// Add a shortcode to replace for current product ID | |
add_shortcode('otk_product_id', function() { | |
return get_the_ID(); | |
}); | |
// Hack elementor to use our shortcode | |
add_action( 'elementor/frontend/the_content', function( $content ) { | |
return str_replace( array('[otk_product_id]','%5Botk_product_id%5D'), get_the_ID(), $content ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any of these plugins could be set at the mu-plugins folder of WP