You might even try something like this to switch it back if it modifies the value..
Lua Code:
hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
if attribute ~= 'showgrid' then return end
self:SetAttribute('showgrid',0)
if not HasAction(self.action) then
self:Hide()
end
end)
So if SetAttribute gets called on the action button it just resets it back to 0.