Skip to content

Commit

Permalink
Compatibilité WordPress 5.0 et PHP 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yannkozon committed Dec 16, 2018
1 parent 24760ad commit 8b539b3
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 47 deletions.
16 changes: 16 additions & 0 deletions disable-feed-comments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
defined('ABSPATH') or die();

/*
MU Plugin: disable-feed-comments
Description: Disable feed comments - RSS, Atom...
Author: Yann Kozon
Author URI: https://www.yannkozon.com
*/

function mu_disable_feed_comments() {
wp_redirect( esc_url( home_url( '/' ) ), 301 );
die();
}
add_action( 'do_feed_rss2_comments', 'mu_disable_feed_comments' );
add_action( 'do_feed_atom_comments', 'mu_disable_feed_comments' );
4 changes: 1 addition & 3 deletions disable-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ function mu_disable_feed() {
add_action( 'do_feed_rdf', 'mu_disable_feed' );
add_action( 'do_feed_rss', 'mu_disable_feed' );
add_action( 'do_feed_rss2', 'mu_disable_feed' );
add_action( 'do_feed_atom', 'mu_disable_feed' );
add_action( 'do_feed_rss2_comments', 'mu_disable_feed' );
add_action( 'do_feed_atom_comments', 'mu_disable_feed' );
add_action( 'do_feed_atom', 'mu_disable_feed' );
30 changes: 16 additions & 14 deletions disable-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,23 @@
Author URI: https://www.yannkozon.com
*/

function mu_disable_rest_api( ) {
remove_action( 'init', 'rest_api_init' );
remove_action( 'parse_request', 'rest_api_loaded' );
function mu_disable_rest_api() {
if( ! is_user_logged_in() ) {
remove_action( 'init', 'rest_api_init' );
remove_action( 'parse_request', 'rest_api_loaded' );

remove_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
remove_action( 'wp_head', 'rest_output_link_wp_head' );
remove_action( 'template_redirect', 'rest_output_link_header', 11 );
remove_action( 'auth_cookie_malformed', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_expired', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_bad_username', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_bad_hash', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_valid', 'rest_cookie_collect_status' );
remove_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
remove_action( 'wp_head', 'rest_output_link_wp_head' );
remove_action( 'template_redirect', 'rest_output_link_header', 11 );
remove_action( 'auth_cookie_malformed', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_expired', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_bad_username', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_bad_hash', 'rest_cookie_collect_status' );
remove_action( 'auth_cookie_valid', 'rest_cookie_collect_status' );

add_filter( 'rest_enabled', '__return_false' );
add_filter( 'rest_jsonp_enabled', '__return_false' );
add_filter( 'rest_enabled', '__return_false' );
add_filter( 'rest_jsonp_enabled', '__return_false' );
}
}

mu_disable_rest_api();
add_action( 'init', 'mu_disable_rest_api' );
2 changes: 1 addition & 1 deletion remove-login-error.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
Author URI: https://www.yannkozon.com
*/

add_filter( 'login_errors', create_function( '$a', "return null;" ) );
add_filter( 'login_errors', '__return_null' );
17 changes: 0 additions & 17 deletions remove-recaptcha-frontend-itsec.php

This file was deleted.

12 changes: 5 additions & 7 deletions remove-wp-embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
Author URI: https://www.yannkozon.com
*/

remove_action( 'wp_head', 'rest_output_link_wp_head' );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
remove_action( 'template_redirect', 'rest_output_link_header', 11, 0 );

function mu_remove_wp_embed() {
wp_deregister_script( 'wp-embed.min.js' );
wp_deregister_script( 'wp-embed' );
wp_deregister_script( 'embed' );
if( ! is_admin() ) {
wp_deregister_script( 'wp-embed.min.js' );
wp_deregister_script( 'wp-embed' );
wp_deregister_script( 'embed' );
}
}
add_action( 'init', 'mu_remove_wp_embed', 9999 );
6 changes: 1 addition & 5 deletions remove-wp-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@
*/

remove_action( 'wp_head', 'wp_generator' );

function mu_remove_wp_version() {
return '';
}
add_filter( 'the_generator', 'mu_remove_wp_version' );
add_filter( 'the_generator', '__return_empty_string' );

0 comments on commit 8b539b3

Please sign in to comment.