You need to wait until these frames are setup before you can hide anything. Try this:
Lua Code:
local f = CreateFrame("Frame") --we need a frame to listen for an event
f:RegisterEvent("PLAYER_ENTERING_WORLD") --we'll listen for this event - all the UI stuff should be done loading by now
f:SetScript("OnEvent", function(self, event) --when the event fires we want this to happen
PlayerFrameTexture:Hide()
PetFrameManaBar:Hide()
end)
Put the above into your Lua file, or you can use this to make your addon instead:
https://addon.bool.no/