Title: compatible with WordPress6.0 &amp; PHP 8.0?
Last modified: May 29, 2022

---

# compatible with WordPress6.0 & PHP 8.0?

 *  Resolved Anonymous User
 * (@anonymized-15761313)
 * [4 years ago](https://wordpress.org/support/topic/compatible-with-wordpress6-0-php-8-0/)
 * Hello Genius [@ravanh](https://wordpress.org/support/users/ravanh/).
    Is `XML
   Sitemap & Google News` compatible with WordPress6.0 & PHP 8.0? After upgrading
   WordPress6.0 & PHP 8.0, I got this Fatal error on “sitemap-posttype-news.*.xml”.
 *     ```
       2022/05/29 06:04:06 [error] 5806#0: *163418 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: Illegal offset type in isset or empty in /home/my-site/DocumentRoot/wp-content/plugins/xml-sitemap-feed/controllers/class.xmlsf-sitemap.php:303
       Stack trace:
       #0 /home/my-site/DocumentRoot/wp-content/plugins/xml-sitemap-feed/views/feed-sitemap-posttype.php(13): XMLSF_Sitemap->prefetch_posts_meta()
       #1 /home/my-site/DocumentRoot/wp-includes/template.php(770): require_once('/home/...')
       #2 /home/my-site/DocumentRoot/wp-content/plugins/xml-sitemap-feed/controllers/functions.shared.php(186): load_template('/home/...')
       #3 /home/my-site/DocumentRoot/wp-includes/class-wp-hook.php(307): xmlsf_load_template(false, 'sitemap-posttyp...')
       #4 /home/my-site/DocumentRoot/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
       #5 /home/my-site/DocumentRoot/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
       #6 /home/my-site/DocumentRoot/wp-includes/functions.php" while reading response header from upstream, client: 66.249.66.26, server: mysite.com, request: "GET /sitemap-posttype-news.202205.xml HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "mysite.com"
       ```
   
 * with PHP 8.0, “sitemap.xml” works fine but “sitemap-posttype-news.*.xml” gets
   Fatal error.
    with PHP 7.4, ALL works fine.
 * I’m using…
    – PHP 8.0.19 – WordPress 6.0 – MariaDB 10.5.16 – nginx/1.21.6 – CentOS
   Linux release 7.9.2009 – my server is on AWS EC2 t3a.micro – All other plugins
   are disabled – Default theme (Twenty Twenty-Two)

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

 *  Plugin Author [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [4 years ago](https://wordpress.org/support/topic/compatible-with-wordpress6-0-php-8-0/#post-15691829)
 * Hi, thank you for reporting the issue. So you have a custom post type “News”?
   You write that all other plugins are disabled and you are using the default theme
   so I wonder how/where this custom post type is defined. And do you know the parameters
   that were used in `register_post_type()` for your custom post type?
 * In any case, if you are prepared to edit the plugin files, you could fix it right
   now instead of waiting for the next release.
 * Go to Plugins > Plugin File Editor, select the plugin XML Sitemap & Google News
   and browse to the file controllers > class.xmlsf-sitemap.php
 * Find the ling 303 that should show this:
 *     ```
       if ( ! isset($this->post_types[$post_type]) ) return;
       ```
   
 * and modify that to:
 *     ```
       if ( empty( $post_type ) || ! is_string( $post_type ) || ! isset($this->post_types[$post_type]) ) return;
       ```
   
 *  Thread Starter Anonymous User
 * (@anonymized-15761313)
 * [4 years ago](https://wordpress.org/support/topic/compatible-with-wordpress6-0-php-8-0/#post-15692982)
 * I apologize I forgot to say that I wrote these code on theme’s `functions.php`
 *     ```
       add_action( 'init', function () { 
       	register_post_type( 'news', [ 
       		'label' => 'Latest News!',
       		'public' => true,
       		'menu_position'=>30,
       		'supports' => array('title', 'editor', 'thumbnail' ), 		
       		'show_in_rest'=>true,
       		'has_archive' =>true, 
       	]);
       });
       ```
   
 * Thank you very much for your answer. After modifying `class.xmlsf-sitemap.php`,
   Fatal errors disappeared. Fixed👍
    I am looking forward to being next version
   released.👍👍
 *  Plugin Author [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [4 years ago](https://wordpress.org/support/topic/compatible-with-wordpress6-0-php-8-0/#post-15693384)
 * Strange. I tried to reproduce the issue with your register post type code on 
   PHP 8.0.19, WP 6.0 and XML Sitemap & Google News 5.3.3 but I get no error message.
   Not even a notice…
 * Anyway, good to hear the patch fixed it for you 🙂

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

The topic ‘compatible with WordPress6.0 & PHP 8.0?’ is closed to new replies.

 * ![](https://ps.w.org/xml-sitemap-feed/assets/icon-128x128.png?rev=1112143)
 * [XML Sitemap & Google News](https://wordpress.org/plugins/xml-sitemap-feed/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/xml-sitemap-feed/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/xml-sitemap-feed/)
 * [Active Topics](https://wordpress.org/support/plugin/xml-sitemap-feed/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/xml-sitemap-feed/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/xml-sitemap-feed/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/compatible-with-wordpress6-0-php-8-0/#post-15693384)
 * Status: resolved