PHP 35
Wp security By micha on 28th October 2019 11:28:59 AM
  1. /*
  2. * DISABLE REST ENDPOINTS
  3. * need to be enabled for wordpress blocks to function
  4. */
  5.  
  6. /*
  7. add_filter( 'rest_endpoints', 'remove_default_endpoints' );
  8. function remove_default_endpoints( $endpoints ) {
  9. return array( );
  10. }
  11. */
  12.  
  13. // REST API - change default rest access route from wp-json
  14. function rest_url_prefix() {
  15. return 'api';
  16. }
  17. add_filter( 'rest_url_prefix', 'rest_url_prefix' );
  18. // REDIRECT AUTHORS
  19. function author_page_redirect() {
  20. if ( is_author() ) {
  21.   wp_redirect( home_url() );
  22. }
  23. }
  24. add_action( 'template_redirect', 'author_page_redirect' );
  25. // REMOVE XMLRPC
  26. add_filter( 'xmlrpc_enabled', '__return_false' );
  27. function remove_xmlrpc_pingback( $headers ) {
  28. unset( $headers['X-Pingback'] );
  29. return $headers;
  30. }
  31. add_filter( 'wp_headers', 'remove_xmlrpc_pingback' );
  32.  
  33.  
  34. /*
  35. * WP CONFIG
  36. * Block externals
  37. */
  38. define('WP_HTTP_BLOCK_EXTERNAL', true);
  39. define('WP_ACCESSIBLE_HOSTS', 'downloads.wordpress.org,wordpress.org');

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.