Closed
Description
This issue is a follow-up to #5702.
Instead of throwing errors, I think we should throw a warning and remove the offending element from the theme.
library(ggplot2)
ggplot(mpg, aes(displ, hwy)) +
geom_point() +
theme(foobar = "qux")
#> Error in `plot_theme()` at ggplot2/R/plot-build.R:178:3:
#> ! The `foobar` theme element is not defined in the element hierarchy.
Created on 2024-02-28 with reprex v2.1.0