Clear all

Paid Addons Support Forum Only

Please note, that here we only support Paid Addons issues and questions.

gVectors Support staff works from 6am to 6pm (GMT+0)

All questions related to wpForo and wpDiscuz free plugins should be asked in the corresponding plugin support forum:


wpDiscuz Support Forum   wpForo Support Forum

Remove WPDiscuz styling from WordPress head  


New Member
Joined: 2 years ago
Posts: 1
03/12/2018 9:05 pm  


I'm curious if anyone has found a way to use the functions.php file in a child theme to remove the WPDiscuz CSs styling from the head. Those settings never change and I want to load them from within my custom external stylesheet that is loaded only on single post pages instead of within the HTML. I've found a function called InitCustomCSS while looking through the plugin files in my cPanel, but I cannot figure out how to remove that action from the wp_head, which I assume the function is hooking into to add styling to the head. If anyone has figured out a way to remove WPDiscuz's styling from the head section that'd be terrific. 

This topic was modified 2 years ago by lostnotstranded

Support Team Admin
Joined: 3 years ago
Posts: 4386
04/12/2018 4:04 pm  

Hi  lostnotstranded,

I'm really sorry, but there is no any way to do it. We'll take it into consideration for future releases.

New Member
Joined: 2 years ago
Posts: 1
27/12/2018 4:11 am  

I stumbled over this thread while searching for a solution for this problem.

To solve it I now iterate over the "wp_head" callbacks and search the right one to remove it:

function remove_wpdiscuz_custom_css()
    global $wp_filter;

    $priority = 10;
    $hooks = $wp_filter['wp_head']->callbacks[$priority];
    foreach ($hooks as $hook) {
        if (isset($hook['function'][0]) && $hook['function'][0] instanceof WpdiscuzCss && $hook['function'][1] == 'initCustomCss') {
            remove_action('wp_head', $hook['function'], $priority);

add_action('wp_head', 'remove_wpdiscuz_custom_css', 8);


New Member
Joined: 9 months ago
Posts: 2
10/01/2020 4:57 pm  


I followed your suggestion and Query Monitor is showing that the hook is no longer registered inside wp_head, and yet... the inline CSS gets printed inside my document head regardless.

(no i'm not using a caching plugin)

Has anyone figured out how to stop initCustomCss from firing? Is the plugin doubling down on the method somewhere else?

Noble Member Moderator
Joined: 1 year ago
Posts: 1301
11/01/2020 12:45 pm  


We've just checked on our test website and don't find such an issue. Everything works fine.
Could you please check one more time.

New Member
Joined: 9 months ago
Posts: 2
13/01/2020 4:32 pm  

I've figured it out – I missed a small detail! I didn't realize @mirsch was using a hook priority of 8. I had it at 10 in my theme functions file. It might seem counterintuitive in a way, but it needs to have a higher priority than the initCustomCss hook so that it can deregister it before it's executed by WordPress.

I guess Query Monitor can't figure out whether something actually executed before being removed by a function that happens to have the same priority.

Scroll to top

Your Cart