How can I conditionally add the filter option_home?
Assuming that if wp_sitemaps_enabled has a filter and it has that because we wanted to set it to false, otherwise it defaults to true for public sites. So I would just use and check whether it is filtered or not: add_filter( ‘wp_sitemaps_enabled’, ‘__return_false’ ); if (has_filter( ‘wp_sitemaps_enabled’) === true) { add_filter(‘option_home’, ‘any_callback_function’); } else { … Read more