While debugging WordPress site, i found the following bug  that are really frustrating and brain storming.

  1. Grid mode may not work on media library
  2. Media gallery will  remain loading
  3. Admin panel may goes blank on switching theme or your front-end will remain totally blank without any error. Even if you had enable wp_debug mode.
  4. Widgets automatically close after clicking to dropdown icon
  5. Header already sent

If you face any problems like this you try by  following this  practice:

  1. Check whether you have included some js on head or on body  section without using wp_head hook or without wrapping  to any hook of WP.
  2. Always make a habit of using less closing and opening of php tag.  Here is the example:


demostration

  <?php function theme_show_another_demo () { //you code }

We frequently use closing and opening tag while including html/css/js file inside php file or inside function. On that condition you should not code as given on the example. Doing this you may face stupid error on switching theme. There you should minimize opening of php tag after curly braces. This is best practice


demostration

<?php } function theme_show_another_demo () { //you code }

3> Never use spaces before opening of php tag on very beginning of template file. let say we on header.php file we have done like this:

//spaces here




<html >

<meta http-equiv="X-UA-Compatible" content="IE=edge" charset="">

//code here

Placing spaces before opening php tag brings header already send error. So always keep on mind while creating new template.

4> Better to hit enter buttom after closing of php multiple comment

5> Remove closing of php tag at the end of template file like page.php , single.php etc

6> Never use  init hook to add css/html/js for admin section or for any other purpose. It may down your site.

Once i had placed closing of php tag on certain template and my widgets closed automatically when opening.

Hope this article may help you on debugging while you face such problems

See here to know more on error on WordPress :

https://codex.wordpress.org/FAQ_Troubleshooting#How_to_clear_the_.22Briefly_unavailable_for_scheduled_maintenance.22_message_after_doing_automatic_upgrade.3F

Note: Feels free to add comment on some more stupidity practice on WordPress and with its solution also. Or else you can mail me at adhsushil7@gmail.com.

Lets maintain WordPress slogan  “Code is Poetry”

Thanks

Advertisement

Join the Conversation

1 Comment

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: