Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [error-handling]

The tag has no usage guidance.

0
votes
0answers
50 views

Error handling for wpdb error - displaying an error message to the user

I want to display an error message to a user when a php POST form fails. The form lets a user create a new team on my site. If the team name is not unique, the query fails. I want to display a generic ...
0
votes
1answer
82 views

Show error messages to a user when database insert fails

I want to show a generic error message to a user when a database query fails on my site. I'm new to wordpress and I'm not sure how to go about it. I have the following function in my functions.php ...
1
vote
0answers
16 views

Handle new created WP_Error

Is it possible to set up a global function for catching new created WP_Error instances? I would like to catch all of them and send error logs to Sentry
0
votes
0answers
60 views

wc_add_notice only work when i'm logged in

I use wc_add_notice to show error message to user. but my message appeared only when i'm logged in ! if(!preg_match('/^[0-9a-zA-Z]{8}$/',$cat_name)) { wc_add_notice( 'Your name is invalid!', '...
0
votes
1answer
2k views

How to log plugin errors to plugin error_log file

How can errors, specific to a given plugin, be logged to an error_log file contained within the plugin root folder itself? Examples: Syntax errors Database errors Compatibility errors PHP fatal ...
2
votes
1answer
509 views

Wordpress showing install screen after max_questions error

I am working in a PHO environment in Heroku with ClearDB. At some point (really low), I get this error: WordPress database error User 'XX' has exceeded the 'max_questions' resource (current value: ...
0
votes
1answer
462 views

Custom form validation

I have created a basic form which can be POST to admin-post.php and also submitted via an AJAX call to admin-ajax.php. Both submissions work correctly, use the nonce for a little extra security, and I ...
0
votes
1answer
958 views

ERROR: Cookies are blocked due to unexpected output - ultimate solution

I know this problem can happen but I need ultimate solution. My main error is: ERROR: Cookies are blocked due to unexpected output. For help, please see this documentation or try the support ...
0
votes
1answer
25 views

How to send logs to plugin owner for a plugin?

I am developing a plugin(that is already on WordPress) and wanted to know that how to do set up to get error logs from customers? Also, any idea on how to omit logs that should only be shown to ...
0
votes
1answer
29 views

Reporting errors in a shortcode plugin

I have a plugin that expands a spanning shortcode into a <table>, and one of the parameters is the number of columns, eg: [table cols=3] Row 1 Data 33% Row 2 Data 67% [/table] Now, using the ...
0
votes
1answer
39 views

Preserve old values on error in setting API

I am trying to preserve old value of form when it fails the validation defined in sanitize callback of register_setting. But it does not do so, instead it save the default values register_setting('...
1
vote
1answer
1k views

contact form ajax empty response error message

I have two contact forms in my theme, one of them saves the contact information in a custom post and send emails to user and admin, and is working great. The other has to send the email, but not save ...
2
votes
2answers
983 views

Add error message on password protected pages

Is there a way to add an "incorrect password" error message on password protected pages? I've looked everywhere and the closest thing I can find is from here: Add error message on password protected ...
2
votes
1answer
766 views

Suppress deprecated notices

When I use: define('WP_DEBUG', 1); In my wp-config.php, it works fine, but I am hacking an old theme and I would like to suppress deprecated notices. My understanding is that adding this: ...
8
votes
1answer
996 views

When to use Exceptions vs Error Objects vs just plain false/null

I'm in the process of writing a plugin and I'm trying to gauge when to use different approaches of handling errors. There are three methods I'm considering: Throwing an Exception (custom class) ...
1
vote
1answer
1k views

How do I show the WP admin error page?

I'm building a simple event calendar, and I want to show a WP error page, for example when users try to edit an event that does not exist, see the attached picture (which is when you try to edit a ...
6
votes
1answer
5k views

See error message from wp_insert_post function?

I'm using wp_insert_post function to insert a new post: $result = wp_insert_post(array("post_title"=>"test1"), true); When I echo the result of the function, I get the number 335. How can I see ...
0
votes
0answers
157 views

WordPress displays 500 error on PHP errors

For some reason WP is showing a generic 500 Internal Server Error page when I have PHP errors in my code. I have set WP_DEBUG to true, and the following settings in my php.ini file: error_reporting = ...
5
votes
1answer
439 views

Showing WP_Error message with admin_notice action hook

I have just get an answer to one of my question but the problem is I want to print an error when every user will insert tags of more than two words through post-new.php with admin_notice action hook. ...
5
votes
1answer
53k views

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 ...
-3
votes
1answer
159 views

How can i get rid of warning messages [closed]

URL:http://www.gazettevandetroit.com/ Error: Warning: Invalid argument supplied for foreach() in /home/gazettev/public_html/wp-content/themes/exquisite-wp/template-home.php on line 118 Code File: ...
0
votes
1answer
444 views

Disable Debug Log Programmatically

I'm trying to disable WP_DEBUG_LOG if and only if debug.log exists. I'd like to hook into wp_footer and test if the file exists and if so disable my debug log. All I've found though is that ...
1
vote
1answer
1k views

(updated) How to add AJAX error handling to a (fully) custom registration form?

Update 2.1: Okay, after messing around with this some more I remembered that I hadn't included the JS file which was causing the white screen, OOPS! ;) Now the form does not submit the data nor send ...
3
votes
2answers
9k views

How to show an error message after publishing a post?

I'm using the transition_post_status hook to perform some operations after publishing a post. In some conditions I would like to show an error message in a red box under "Edit Post" and above "Post ...
1
vote
1answer
370 views

php console log speed [closed]

How do I log speed benchmarks to a console in php? I don't want to echo the results for the user to see, but just in some kind of log. I know that I can get the time elapsed with this: $first = ...
2
votes
1answer
2k views

Handling duplicates with wp_insert_term()

I'm using wp_insert_term which works quite well Now I want some error handler for when using the same name. $term_id = wp_insert_term( $term, 'wpsc_product_category', $args ); if($term_id) {//my ...
0
votes
1answer
48 views

Returning error upon comment being flagged as spam

Hello Im using a custom filter that hooks to pre_comment_approved to look for bad words in a custom way. Now when the comment gets flagged it returns spam. How could I post back an error to the ...
0
votes
2answers
643 views

customize wordpress database error page

UPDATE Initially I suspected this was related to the Wordpress framework I'm using (Genesis) or to my child theme functionality, but turns out that's not the case as I was able to get this to work in ...
0
votes
0answers
20 views

How to handle a “Error establishing a database connection”? [duplicate]

For a little project i am using WP by loading require( '../site/wp-load.php'); When the local msyql server is running everything works great. But in certain situations the local mysql server isn't ...
4
votes
1answer
1k views

Wordpress PHP error handling and reporting in production environment

I'm trying to find a solution on how to handle the displaying and logging of errors in a PHP (Wordpress) production environment. Is it possible to do the following (alternative suggestions welcome): ...
4
votes
3answers
3k views

How to log mysql errors from wordpress core?

I am developing a wordpress site and I would like to be able to log and handle mysql errors from wordpress core. My site has a mix of wordpress pages and posts + a few php pages that run under the ...
-2
votes
1answer
423 views

How to get an error message if a form is empty (plugin: Post for site) [closed]

I wonder if you intelligent friends can detect the problem in this code. I want the form to display an error message if it's empty. Now it just goes to my completed form page. <?php /* * * * ...
1
vote
1answer
10k views

Contact Form 7 - Debugging email send failres [closed]

I am getting the red failed error when trying to send a message. I referred to the FAQ and this is the extent of help available: "There are really various reasons for server side problems, so I can’...
1
vote
0answers
2k views

Stop saving process when metabox is invalid [duplicate]

Possible Duplicate: Prevent post from being published if custom fields not filled Check before publishing, if already exist post with current custom field value I am trying to add some ...
0
votes
1answer
844 views

Form validation on user profile edit

I have added a custom field to user profiles in bbPress however I am unsure how to do form validation other than javascript. I would like to do some PHP validation however the few things I have tried ...
1
vote
1answer
364 views

How to make my plugin code die gracefully

I've set up a class for my function, and I'd like to implement some form of error handling. But I'm new to this error handling lark. Can I set_error_handler to only show certain messages (and can ...
0
votes
1answer
1k views

Alphanumeric usernames and error message for it

I'm facing a problem where I haven't seen proper answer anywhere. What I need help with is this: How can I prevent my users registering non-alphanumeric usernames? To be exact, I could prevent it by ...
1
vote
2answers
970 views

Auto-detect javascript errors and warn theme user

This may sound simple, but it's not :) What I want, and most likely many theme developers do (themes that use javascript / jquery), is to warn the theme user that his site has javascript errors. In ...