I have this code in a simple plugin that is supposed to make wordpress unbranded:
<?php
/*
* Class to remove wp-* branding from WordPress
* @package users-manager.php
*/
class WpUnbrand {
public function __construct()
{
add_action('wp_head', array($this, 'remove_wp_header_links'));
add_action('init', array($this, 'remove_wp_default_jquery'));
}
public function remove_wp_header_links()
{
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'feed_links_extra', 3);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
remove_action('wp_head', 'parent_post_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
}
public function remove_wp_default_jquery()
{
if( !is_admin() ){
wp_deregister_script('jQuery');
wp_register_script( 'jQuery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js', false, false);
wp_enqueue_script( 'jQuery' );
}
}
}
new WpUnbrand();
?>
At the moment the plugin is in development so I didn't added the needed headers and I'm calling it inside another plugin like a component of the other plugin. I want to make is an indipendent plugin, but I've noticed that the wp_head
isn't called. Is there something wrong into the code?