Lua Code:
local testButton = CreateFrame("Button", nil, WorldMapFrame, "UIPanelButtonTemplate")
testButton:SetPoint("CENTER", 0, 0)
testButton:SetFrameStrata("FULLSCREEN")
testButton:SetWidth(230)
testButton:SetHeight(80)
testButton:SetText("Click to hide world map!")
testButton:SetScript("OnClick", function()
if InCombatLockdown() then
WorldMapFrame:Hide()
else
HideUIPanel(WorldMapFrame)
end
end)
Open the map, enter combat with target dummy, press the button. press esc. twice (first clears the dummy), game menu opens.