Is there a plugin that will override the “Error establishing a database connection” message? [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for WordPress Development Stack Exchange. Closed 6 years ago. Improve this question My provider’s database server recently had some downtime and my site was displaying the classic “Error establishing a database connection” message … Read more

Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu

I am trying to add some ARIA related stuff to the wp_nav_menu function. I use a custom walker class for this purpose: class Walker_Nav_Menu_With_Aria extends Walker_Nav_Menu { function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat(“\t”, $depth); $output .= “\n$indent<ul class=\”sub-menu\” role=\”group\”>\n”; } function end_lvl( &$output, $depth = 0, $args … Read more

Should I use spl_autoload_register() in my plugin?

When I use spl_autoload_register in my plugin, I get: Fatal error: Uncaught exception ‘LogicException’ with message ‘Class wp_atom_server could not be loaded’ wp-includes\pluggable-deprecated.php on line 182 I did some reading and found various fixes. One on SO said not to use spl_autoload_register with WordPress. Is that accurate? I’m sure I can find a “fix” for … Read more

Detecting errors generated by $wpdb->get_results()

How do I detect errors when using $wpdb->get_results()? For example: $result = $wpdb->get_results(“SELECT * FROM this is not a valid query”); The preceding code doesn’t generate any exceptions or errors; it simply sets $result to an empty array. How do we reliably detect errors generated by get_results()? 2 s 2 There is a class variable … Read more

Get error messages when $wpdb->insert() returns false?

$wpdb->insert() returns false which I’ve learned means that the insert failed. Now, I would like to know why it fails with the insert. According to this ticket https://core.trac.wordpress.org/ticket/32315 the problem could be that the value is either too long or contains bad characters. Here is the insert query: $result = $wpdb->insert(‘table’, $ins_args, array(‘%d’, ‘%d’, ‘%s’, … Read more

No Error Log File, no debug info

My error when writing a plugin for uploads and yes, I can debug. But it just jumps directly from this line to destruct the end of my wp-config.php EDIT: // Enable WP_DEBUG mode define(‘WP_DEBUG’, true); // Enable Debug logging to the /wp-content/debug.log file define(‘WP_DEBUG_LOG’, true); /** Sets up WordPress vars and included files. */ require_once(ABSPATH … Read more

Why $wpdb->show_errors() and print_error() is showing an output even if the query output is correct?

In order of figuring out the following issue, see https://wordpress.stackexchange.com/questions/178995/sanitize-a-working-query-string-by-using-wpdb-prepare-fails-with-mysql-db-er i ran into an rather odd behaviour. Even that my used query was correct and showing the right output. global $wpdb; $wpdb->show_errors(); $pageposts = $wpdb->get_results( $wpdb->prepare( ” SELECT skposts.* FROM $wpdb->posts skposts, $wpdb->postmeta skpostmeta1, $wpdb->postmeta skpostmeta2 WHERE skposts.ID = skpostmeta1.post_id AND skposts.ID = skpostmeta2.post_id AND … Read more