Title: php 8 errors
Last modified: February 25, 2024

---

# php 8 errors

 *  Resolved [davidgimenez](https://wordpress.org/support/users/davidgimenez/)
 * (@davidgimenez)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-8-errors-13/)
 * Hello, I had to update my PHP version to 8 and I get these types of errors a 
   lot and my theme is storefront.
 * PHP Warning: Attempt to read property “post_type” on null in /home/**_/public\
   _html/wp-content/plugins/header-footer-elementor/inc/lib/target-rule/class-astra-
   target-rules-fields.php on line 1334 PHP Warning: Attempt to read property “ID”
   on null in /home/_**/public_html/wp-content/plugins/header-footer-elementor/inc/
   lib/target-rule/class-astra-target-rules-fields.php on line 1335

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

 *  Thread Starter [davidgimenez](https://wordpress.org/support/users/davidgimenez/)
 * (@davidgimenez)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-8-errors-13/#post-17456573)
 * Update this code:
 * /* Entire Website */ $meta_args = “pm.meta_value LIKE ‘%\”basic-global\”%'”; 
   switch ( $current_page_type ) { case ‘is_404’: $meta_args .= ” OR pm.meta_value
   LIKE ‘%\”special-404\”%'”; break; case ‘is_search’: $meta_args .= ” OR pm.meta_value
   LIKE ‘%\”special-search\”%'”; break; case ‘is_archive’: case ‘is_tax’: case ‘
   is_date’: case ‘is_author’: $meta_args .= ” OR pm.meta_value LIKE ‘%\”basic-archives\”%'”;
   $meta_args .= ” OR pm.meta_value LIKE ‘%\”{$current_post_type}|all|archive\”%'”;
   if ( ‘is_tax’ == $current_page_type && ( is_category() || is_tag() || is_tax())){
   if ( is_object( $q_obj ) ) { $meta_args .= ” OR pm.meta_value LIKE ‘%\”{$current_post_type}
   |all|taxarchive|{$q_obj->taxonomy}\”%'”; $meta_args .= ” OR pm.meta_value LIKE‘%\”
   tax-{$q_obj->term_id}\”%'”; } } elseif ( ‘is_date’ == $current_page_type ) { 
   $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-date\”%'”; } elseif ( ‘is_author’
   == $current_page_type ) { $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-author\”%'”;}
   break; case ‘is_home’: $meta_args .= ” OR pm.meta_value LIKE ‘%\”special-blog\”%'”;
   break; case ‘is_front_page’: $current_post_id = $current_id; $meta_args .= ” 
   OR pm.meta_value LIKE ‘%\”special-front\”%'”; $meta_args .= ” OR pm.meta_value
   LIKE ‘%\”{$current_post_type}|all\”%'”; $meta_args .= ” OR pm.meta_value LIKE‘%\”
   post-{$current_id}\”%'”; break; case ‘is_singular’: $current_post_id = $current_id;
   $meta_args .= ” OR pm.meta_value LIKE ‘%\”basic-singulars\”%'”; $meta_args .=”
   OR pm.meta_value LIKE ‘%\”{$current_post_type}|all\”%'”; $meta_args .= ” OR pm.
   meta_value LIKE ‘%\”post-{$current_id}\”%'”; $taxonomies = get_object_taxonomies(
   $q_obj->post_type ); $terms = wp_get_post_terms( $q_obj->ID, $taxonomies ); foreach(
   $terms as $key => $term ) { $meta_args .= ” OR pm.meta_value LIKE ‘%\”tax-{$term-
   >term_id}-single-{$term->taxonomy}\”%'”; } break; case ‘is_woo_shop_page’: $meta_args.
   = ” OR pm.meta_value LIKE ‘%\”special-woo-shop\”%'”; break; case ”: $current_post_id
   = $current_id; break; }
 * To this code that I corrected:
 * /* Entire Website */
   $meta_args = “pm.meta_value LIKE ‘%\”basic-global\”%'”;
 * switch ($current_page_type) {
   case ‘is_404’:$meta_args .= ” OR pm.meta_value 
   LIKE ‘%\”special-404\”%'”;break;case ‘is_search’:$meta_args .= ” OR pm.meta_value
   LIKE ‘%\”special-search\”%'”;break;case ‘is_archive’:case ‘is_tax’:case ‘is_date’:
   case ‘is_author’:$meta_args .= ” OR pm.meta_value LIKE ‘%\”basic-archives\”%'”;
   $meta_args .= ” OR pm.meta_value LIKE ‘%\”{$current_post_type}|all|archive\”%'”;
 *     ```wp-block-code
           if ('is_tax' == $current_page_type && (is_category() || is_tag() || is_tax())) {
               if (is_object($q_obj)) {
                   $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all|taxarchive|{$q_obj->taxonomy}\"%'";
                   $meta_args .= " OR pm.meta_value LIKE '%\"tax-{$q_obj->term_id}\"%'";
               }
           } elseif ('is_date' == $current_page_type) {
               $meta_args .= " OR pm.meta_value LIKE '%\"special-date\"%'";
           } elseif ('is_author' == $current_page_type) {
               $meta_args .= " OR pm.meta_value LIKE '%\"special-author\"%'";
           }
           break;
       case 'is_home':
           $meta_args .= " OR pm.meta_value LIKE '%\"special-blog\"%'";
           break;
       case 'is_front_page':
           $current_post_id = $current_id;
           $meta_args .= " OR pm.meta_value LIKE '%\"special-front\"%'";
           $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'";
           $meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'";
           break;
       case 'is_singular':
           $current_post_id = $current_id;
           $meta_args .= " OR pm.meta_value LIKE '%\"basic-singulars\"%'";
           $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'";
           $meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'";
   
           if (is_object($q_obj)) {
               $taxonomies = get_object_taxonomies($q_obj->post_type);
               $terms = wp_get_post_terms($q_obj->ID, $taxonomies);
   
               foreach ($terms as $key => $term) {
                   $meta_args .= " OR pm.meta_value LIKE '%\"tax-{$term->term_id}-single-{$term->taxonomy}\"%'";
               }
           }
   
           break;
       case 'is_woo_shop_page':
           $meta_args .= " OR pm.meta_value LIKE '%\"special-woo-shop\"%'";
           break;
       case '':
           $current_post_id = $current_id;
           break;
       ```
   
 * }
 *  Plugin Support [Herman Asrori (BSF)](https://wordpress.org/support/users/bsfherman/)
 * (@bsfherman)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-8-errors-13/#post-17472937)
 * Hi [@davidgimenez](https://wordpress.org/support/users/davidgimenez/),
 * Could you please share with us the exact steps to replicate this case?
 * I look forward to hearing from you.
 * Kind regards,
    Herman 😊
 *  Thread Starter [davidgimenez](https://wordpress.org/support/users/davidgimenez/)
 * (@davidgimenez)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-8-errors-13/#post-17473261)
 * There are no steps to explain, activate version 8.3 of PHP and in the error log
   I could see those errors. If I change version 7.4, I no longer get those errors
   in the log. and I solved it with the code that I gave you, it seems that you 
   have an error in the code that is incompatible with versions 8 of PHP
 *  Plugin Support [Herman Asrori (BSF)](https://wordpress.org/support/users/bsfherman/)
 * (@bsfherman)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-8-errors-13/#post-17475916)
 * That’s it, [@davidgimenez](https://wordpress.org/support/users/davidgimenez/)!
 * This plugin is not yet fully compatible with PHP 8.3. Even this plugin is still
   not fully compatible with PHP 8.2. It will, in the next release.
 * So, please use PHP 8.2 at max or even the lower one, like PHP 8.1 to make sure
   this plugin runs smoothly.
 * Kind regards,
    Herman 😊

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

The topic ‘php 8 errors’ is closed to new replies.

 * ![](https://ps.w.org/header-footer-elementor/assets/icon-256x256.gif?rev=3278750)
 * [Ultimate Addons for Elementor](https://wordpress.org/plugins/header-footer-elementor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/header-footer-elementor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/header-footer-elementor/)
 * [Active Topics](https://wordpress.org/support/plugin/header-footer-elementor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/header-footer-elementor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/header-footer-elementor/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Herman Asrori (BSF)](https://wordpress.org/support/users/bsfherman/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/php-8-errors-13/#post-17475916)
 * Status: resolved