Title: developer question
Last modified: November 14, 2019

---

# developer question

 *  Resolved [Peter Raschendorfer](https://wordpress.org/support/users/petersplugins/)
 * (@petersplugins)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/developer-question-2/)
 * Is it safe to use WPSEO_Options::get( ‘enable_xml_sitemap’ ) in my plugin to 
   detect if the XML sitemap feature is activated?
 * Or is there any other function for plugin developers to use?
 * Thanks in advance.
 * Regards,
    Peter

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Saša](https://wordpress.org/support/users/stodorovic/)
 * (@stodorovic)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/developer-question-2/#post-12133916)
 * You can use something like this, but it’s possible that Yoast will change it 
   in the future (example it’s possible that this class could be moved to other 
   namespace). Other way is checking existence of object `$GLOBALS['wpseo_sitemaps']`(
   Probably easier and faster way).
 * From other side, if someone deactivates Yoast SEO then it’s possible PHP fatal
   error. I recommend to you check existence of the method with [method_exists](https://www.php.net/manual/en/function.method-exists.php)
   before calling it. Something like this:
 *     ```
       if ( method_exists( 'WPSEO_Options', 'get' ) && WPSEO_Options::get( 'enable_xml_sitemap' ) ) {
       	/* sitemaps are enabled */
       }
       ```
   
 *  Thread Starter [Peter Raschendorfer](https://wordpress.org/support/users/petersplugins/)
 * (@petersplugins)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/developer-question-2/#post-12141126)
 * Many thanks for your response. I’m aware of that. That is exactly the reason 
   for my question. I’d like to know from someone from Yoast if it is future proof
   to use this method or not. Therefore, I don’t mark this topic as resolved. Maybe
   I can get feedback from Yoast.
 *  [Saša](https://wordpress.org/support/users/stodorovic/)
 * (@stodorovic)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/developer-question-2/#post-12158108)
 * I think that checking of the object `$wpseo_sitemaps` (_class WPSEO\_Sitemaps_)
   is easier/faster way because other plugins use method [register_sitemap](https://developer.yoast.com/code-documentation/plugins/yoast-seo/classes/wpseo_sitemaps-register_sitemap/2/)
   to add custom sitemaps (I use this method). You can look an example – [here](https://gist.github.com/amboutwe/8cfb7a3d8f05e580867341d4ff84141d).
 * If you want better answer then I think that you should post this question on 
   [github](https://github.com/Yoast/wordpress-seo/issues).
 *  [Jerlyn](https://wordpress.org/support/users/jerparx/)
 * (@jerparx)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/developer-question-2/#post-12189071)
 * Closed. No further concerns.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘developer question’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-seo/assets/icon-256x256.gif?rev=3419908)
 * [Yoast SEO - Advanced SEO with real-time guidance and built-in AI](https://wordpress.org/plugins/wordpress-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Jerlyn](https://wordpress.org/support/users/jerparx/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/developer-question-2/#post-12189071)
 * Status: resolved