Sunday, 26 October 2025

Cara-Cara Untuk Bypass/Solve: Database Problem.

 Warning: Attempt to read property "post_status" on null in /home/xxx/public_html/wp-admin/includes/template.php on line 2298

Warning: Attempt to read property "post_status" on null in /home/xxxx/public_html/wp-admin/includes/template.php on line 2302 Warning: Attempt to read property "post_status" on null in /home/xxx/public_html/wp-admin/includes/template.php on line 2308 Warning: Attempt to read property "post_status" on null in /home/xxxpublic_html/wp-admin/includes/template.php on line 2312 Warning: Attempt to read property "ID" on null in /home/xxxx/public_html/wp-admin/includes/template.php on line 2316

Cara-Cara Untuk Bypass/Solve:

1. Quick Fix - Hide Warning (Sementara)

Tambahkan dalam wp-config.php:

php
// Sembunyikan warning (temporary solution)
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
// ATAU
ini_set('display_errors','Off');

2. Fix Root Cause - Database Repair

Error ini biasanya disebabkan corrupted post data dalam database.

Langkah-langkah:

  1. Enable Database Repair:

php
// Dalam wp-config.php
define('WP_ALLOW_REPAIR', true);
  1. Pergi ke URLyourwebsite.com/wp-admin/maint/repair.php

  2. Klik kedua-dua butang:

    • "Repair Database"

    • "Optimize Database"

3. Plugin Solution

Install plugin "Health Check & Troubleshooting":

  • Pergi ke Plugins → Add New

  • Cari "Health Check"

  • Activate dan run troubleshooting mode

4. Manual SQL Fix (Advanced)

Jalankan query ini dalam phpMyAdmin:

sql
-- Cari posts yang corrupted
SELECT * FROM wp_posts WHERE post_status IS NULL OR post_title IS NULL;

-- Delete posts yang corrupted (HATI-HATI!)
DELETE FROM wp_posts WHERE post_status IS NULL;

5. Disable Problematic Plugin/Theme

php
// Dalam wp-config.php - disable plugins
define('WP_DISABLE_FATAL_ERROR_HANDLER', true);

// ATAU rename folder plugins via cPanel/FTP
// wp-content/plugins → wp-content/plugins-deactivate

6. Custom Code Fix (Permanent)

Tambahkan dalam functions.php theme anda:

php
// Fix untuk null post object
add_action('wp_loaded', 'fix_null_post_errors');
function fix_null_post_errors() {
    if (is_admin() && !defined('DOING_AJAX')) {
        // Clear corrupted post cache
        wp_cache_flush();
    }
}

Recommen

Cara-Cara Untuk Bypass/Solve: Database Problem.

  Warning: Attempt to read property "post_status" on null in /home/xxx/public_html/wp-admin/includes/template.php on line 2298 Wa...