Title: WordPress Debug line 285
Last modified: December 16, 2023

---

# WordPress Debug line 285

 *  Resolved [siavashkhazaei](https://wordpress.org/support/users/siavashkhazaei/)
 * (@siavashkhazaei)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wordpress-debug-line-285/)
 * **Warning**: Undefined variable $post in **/home/\*\*\*\*/public_html/wp-content/
   plugins/adminimize/adminimize.php** on line **285**
 * **Warning**: Attempt to read property “ID” on null in **/home/\*\*\*\*\*/public_html/
   wp-content/plugins/adminimize/adminimize.php** on line **285**

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

 *  [mzapfe](https://wordpress.org/support/users/mzapfe/)
 * (@mzapfe)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wordpress-debug-line-285/#post-17282601)
 * Same warning fills debug.log
 *  [vannatcpcpdottw](https://wordpress.org/support/users/vannatcpcpdottw/)
 * (@vannatcpcpdottw)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wordpress-debug-line-285/#post-17284980)
 * same here
   roll back to 1.11.9
 *  [Guilherme Souza](https://wordpress.org/support/users/gsouza/)
 * (@gsouza)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/wordpress-debug-line-285/#post-17336396)
 * Same warning fills debug.log
 * 
   Warning: Undefined variable $post in /wp-content/plugins/adminimize/adminimize.
   php on line 285
 * Warning: Attempt to read property “ID” on null in /wp-content/plugins/adminimize/
   adminimize.php on line 285
    -  This reply was modified 2 years, 3 months ago by [Guilherme Souza](https://wordpress.org/support/users/gsouza/).
 *  [choegl](https://wordpress.org/support/users/choegl/)
 * (@choegl)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/wordpress-debug-line-285/#post-17371530)
 * Enclosing line 285 in an if statement and checking if $post is set resolves the
   issue. Necessary code below. Replace line 285 of adminimize.php with the entire
   code.
 * What is the best way to get that included in the next official release?
 *     ```wp-block-code
           // Ensure $post is set and not null before accessing its properties
           if ( isset( $post ) && $post !== null ) {
               $current_post_type = get_post_type($post->ID);   // current line 285
           } else {
               // Fallback logic if $post is not set or is null
               $current_post_type = null;
           }
       ```
   
 *  [choegl](https://wordpress.org/support/users/choegl/)
 * (@choegl)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/wordpress-debug-line-285/#post-17372039)
 * Turns out this resulted in another error in inc-setup/dashboard.php. I replaced
   the loop in lines 150-177 with this code:
 *     ```wp-block-code
       foreach ( (array) $wp_meta_boxes['dashboard'] as $context => $datas ) {
   
       foreach ( (array) $datas as $priority => $data ) {
   
       foreach ( (array) $data as $widget => $value ) {
   
       // Use a temporary variable for title manipulation
   
       $title = isset($value['title']) ? $value['title'] : '';
   
       // Convert boolean false to an empty string
   
       if ($title === FALSE) {
   
       $title = '';
   
       }
   
       // If title is an array, reset to empty string
   
       if (is_array($title)) {
   
       $title = '';
   
       }
   
       $widgets[$widget] = array(
   
       'id' => $widget,
   
       'title' => strip_tags(
   
       preg_replace('/( |)<span.*span>/im', '', $title)
   
       ),
   
       'context' => $context,
   
       'priority' => $priority,
   
       );
   
       }
   
       }
   
       }
       ```
   
 *  [delavigne](https://wordpress.org/support/users/delavigne/)
 * (@delavigne)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/wordpress-debug-line-285/#post-17387960)
 * Thanks a lot.
 *  [qgotv](https://wordpress.org/support/users/qgotv/)
 * (@qgotv)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/wordpress-debug-line-285/#post-17491285)
 * Anyone know when the fix for this will be updated in the plugin? Filling my debug
   log as well. Not really feeling confident to change some of the code that choegl
   talked about.
 *  Plugin Contributor [Frank Bueltge](https://wordpress.org/support/users/bueltge/)
 * (@bueltge)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/wordpress-debug-line-285/#post-17496588)
 * [@choegl](https://wordpress.org/support/users/choegl/) The current version does
   not have this line of code, you are in the last version 1.11.10?
   see [https://github.com/wp-media/adminimize/blob/ae8f7b0d75f6d783f2b4572e3f92fca05fb5559b/adminimize.php#L285](https://github.com/wp-media/adminimize/blob/ae8f7b0d75f6d783f2b4572e3f92fca05fb5559b/adminimize.php#L285)

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

The topic ‘WordPress Debug line 285’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/adminimize_000000.svg)
 * [Adminimize](https://wordpress.org/plugins/adminimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/adminimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/adminimize/)
 * [Active Topics](https://wordpress.org/support/plugin/adminimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/adminimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/adminimize/reviews/)

 * 8 replies
 * 8 participants
 * Last reply from: [Frank Bueltge](https://wordpress.org/support/users/bueltge/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/wordpress-debug-line-285/#post-17496588)
 * Status: resolved