I'm creating a modification of K2 module and I want to remove some unnecesary K2 css and script load.

I have tried to use


but return an error message :

Notice: Indirect modification of overloaded property JFormFieldK2Mods::$_scripts has no effect in /Applications/Ampps/www/j39/modules/mod_k2mods/admin/elements/k2mods.php on line 18

How can I unset unnecesary css and script load properly?

1 Answer 1


I believe that a component overrides the template files as you discovered.

So - your solutioncould be:

a) custom plugin development to remove said files. Here's a discussion: How can I completely remove Bootstrap from the frontend of Joomla?

b) Modify the jdoc:include type=head in your Joomla Template:

c) I use JCC - JS CSS Control plugin - which is the most reliable and simplest way I have found.

I encounter the issue with flexiContent + RSform - so keep my own adaptation:


As you're seeking the administrator - I would search the module folder for the line of code and comment it out.

As I don't use K2, I looked at the mod_k2_Stats and found the following in the tmpl folder - so it could be removed:

if (K2_JVERSION == '30') {
$document = JFactory::getDocument();
    dl.tabs {float:left;margin:10px 0 -1px 0;z-index:50;}
    dl.tabs dt {float:left;padding:4px 10px;border:1px solid #ccc;margin-left:3px;background:#e9e9e9;color:#666;}
    dl.tabs dt.open {background:#f9f9f9;border-bottom:1px solid #f9f9f9;z-index:100;color:#000;}
    div.current {clear:both;border:1px solid #ccc;padding:10px 10px;background:#f9f9f9;}
    dl.tabs h3 {font-size:12px;line-height:12px;margin:4px;}

Or in mod_k2_quick_icons:

K2HelperHTML::loadHeadIncludes(true, false, true, false);
if ($modCSSStyling) {

Or in other non k2 modules:

$url = 'modules/mod_adminmenumanager/javascript/responsive.js';


echo "<script>window.parent.addtomenu_setMessage( '" . JText::_('COM_MENUS_MENU_ITEM_SAVE_SUCCESS', true) . "', 1 );</script>\n";
  • hi @iamrobert, thanks for your answer, but I was talking about backend (administrator page) not frontend
    – webchun
    Commented Mar 3, 2020 at 12:02
  • JCC - JS CSS Control - does have backend removal access: i.imgur.com/SXya8vK.png
    – iamrobert
    Commented Mar 4, 2020 at 15:15
  • Hi - I updated my answer.
    – iamrobert
    Commented Mar 5, 2020 at 3:24

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.