Support » Plugin: XML Sitemaps » WP-CLI command to regenerate sitemap

  • Hallo
    I’m adapting the WP-CLI command witch us available here to the new WP-CLI 2.0.0 requirements. During this process I stack at the end – sitemap regeneration via cli. When I look true code of this plugin I find out that before executing sitemap regeneration for example ~ $_REQUEST witch is not set during cli request. Because of that I have a question: Would it be possible to introduce a condition in the plugin that allows you to perform this action from the WP-CLI level? To check whether WP-CLI is in use you can use this code

    if ( defined( 'WP_CLI' ) && WP_CLI ) {
        // Do WP-CLI-specific things.


  • The topic ‘WP-CLI command to regenerate sitemap’ is closed to new replies.