I have this code in a simple plugin that is supposed to make wordpress unbranded:


* 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_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?

1 Answer 1


If it is your actual code, you have hook to wp_head commented:

//add_action('wp_head', array($this, 'remove_wp_header_links'));

Just remove slashes and it should work.

add_action('wp_head', array($this, 'remove_wp_header_links'));
  • I've commented the hook to continue the plugin development. Also if it's uncommented, it will be not fired and inspecting using chrome console will show me into the <head> tag all the stuff that wordpèress will add
    – OHICT
    Commented Oct 6, 2023 at 7:50
  • Did you try to change priority? You can't remove actions that wasn't created before. So you can try for example this call: add_action('wp_head', array($this, 'remove_wp_header_links'), 20); To be sure your function will be called later.
    – mWin
    Commented Oct 9, 2023 at 17:47
  • need to test, not tried to give a major priority. I'll let you know. Thanks
    – OHICT
    Commented Oct 10, 2023 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.