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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [wp-error]

`WP_Error` is a PHP class used by the WordPress core for error reporting.

2
votes
2answers
35 views

Unable to show error message using wp_login action

My goal is to show an error message when i check if the user is locked or not, the problem is that when the function ends, it redirects to the page that must appear after succesfull login. Objectives:...
0
votes
0answers
35 views

Change default registration errors

I'm trying to change the Wordpress default errors people see when try to register. I'm trying to remove the wordpress original function and create a new one, using this code, but no effect. Any ...
0
votes
0answers
33 views

Object of class WP_Error could not be converted to string line 239

I need help. I get the following error PHP Catchable fatal error: Object of class WP_Error could not be converted to string in /wp-content/themes/continal/framework/template-tags.php on line ...
0
votes
0answers
47 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 ...
1
vote
0answers
15 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
1
vote
0answers
196 views

How do iterate through all errors for a WP_Error object?

I have a block of code that I know contains multiple errors which come from the wpmu_validate_blog_signup function. The error object is part of the $result array. $result = wpmu_validate_blog_signup($...
0
votes
0answers
285 views

Rest WP_Error always return null

I have dificulties in my project, Im using Wordpress with WP Rest APi plugin. Im now making a plugin. The problem is, whenever I return something like this : return new WP_Error('...
0
votes
2answers
424 views

WP_Error could not be converted to string

I try to add an existing user to a blog with the function add_user_to_blog($blog_id, $user_id, $role). The code I use gives me: Catchable fatal error: Object of class WP_Error could not be ...
1
vote
1answer
39 views

Is there an equivalent to WP_Error object I can return in the case of a successful REST request?

In the case of an error at a REST endpoint I've set up, I am accustomed to returning a WP_Error object, which is convenient because I can include a code, a message, and an HTTP status into a single ...
0
votes
1answer
22 views

How do I create a state of “don't assign anything to variable” if WP_Error throws an error?

I have this code to scrape Instagram pictures from a given account: <?php class Scrape_Instagram { private $images = array(); public function __construct( $username ) { $this-&...
0
votes
1answer
19 views

Title tag wont change

I changed the Title of the Blog, in the Customizer and everywhere else i checked the title, it changed, except on the actual site. I already checked, if the tag is set static in the header.php, its ...
1
vote
1answer
249 views

Template administration Error after WP 4.8 update

We are using UpStream template on our WP site. After the last WP 4.8 update, we are getting an error message on the administration panel, which does not allow us to use the slideshow. The error is the ...
0
votes
1answer
828 views

plugin generated unexpected output during activation, but it is empty

I am getting this error what is already answered in several threads here with same problem. Here the error message: The plugin generated 3 characters of unexpected output during activation. If you ...
1
vote
1answer
2k views

Handling nonce generation in AJAX registration process

I am currently working on a multi-steps registration system, based on the new Wordpress Rest API and I got an issue related to the nonce generation and verifying. My first step is to ask the user ...
0
votes
1answer
212 views

Object of class WP_Query could not be converted to int inside shortcode

I have the following code which is used to display download posts by the custom taxonomy. I am receiving the error Object of class WP_Query could not be converted to int When I have Query Monitor ...
0
votes
2answers
261 views

Email Exists ERROR into Ajax registration form

My problem is that I can't verify if some user insert an existing email into AJAX registration form. However my form is working fine, it's registering users and it's giving all other errors, like "...
0
votes
1answer
177 views

WP_Error with multiple form validation message

I'm working on a front-end form plug-in and having trouble getting validation error message work with WP_Error. I spent hours to find a problem but still have no idea. Below code is actually working ...
2
votes
1answer
998 views

How to check if wp_update_post was successful

I want to update a post using wp_update_post( $my_post ); How can I check if it was successful? Should it return the post ID on successful update? I'm trying this: $post_id = wp_update_post( $...
3
votes
1answer
6k views

Issue with wp_insert_post and post_content field error Could not update post in the database

I'm having issues creating an import / caching script to be used within a WordPress site. This feed comes from a single text file that is then parsed and returned as an array. When running through ...
2
votes
1answer
248 views

How to group multiple wp_errors together?

I have created a custom registration form on wordpress. There is validation errors for each field and wordpresss just dumps all errors above the form. I tried to separate these errors into multiple ...
0
votes
1answer
3k views

Why is_wp_error() is not returning false even there's no defined error

On the form submission I'm taking user comment for a custom purpose for my plugin. I'm checking whether the comment field is empty or not, and the comment field is filled with at least 30 characters. ...
0
votes
1answer
286 views

disable WP_error: authentication_failed

I am modifying my wp-login.php but from within functions.php (in order not to hack the core). I need to disable one WP_error with code: authentication_failed. if i hack the core and modify wp-login....
1
vote
1answer
5k views

Cannot use object of type WP_Error as array

Using a WordPress Plugin WPML I have been getting this error on saving a draft post: PHP Fatal error: Cannot use object of type WP_Error as array in /home/user/domain.com/wp-content/plugins/...
3
votes
2answers
5k views

Error timed out with succesfull wp_remote_post

What I'm trying to do: Passing POST data by using wp_remote_post. foreach ( $articles as $article_id ) { $postarray = array( 'method' => 'POST', 'timeout' => 5, '...
0
votes
1answer
13k views

Object of class WP_Error could not be converted to string

After deleting some categories (shouldn't have done this), I get the following error Catchable fatal error: Object of class WP_Error could not be converted to string in [FILENAME] on line 45 ...
0
votes
0answers
117 views

Authenticate return value

I am trying to hook into the authenticate return value to display error message on custom login form. The $user object is not returned. add_action( 'authenticate', 'my_login_check' ); function ...
4
votes
1answer
10k views

get_term_children for immediate children only (not grandchildren)

I want to display term children of a custom taxonomy. Currently, I am able to do this using get_term_children, but using this, it displays children and grandchildren, I want to avoid this and make ...
1
vote
1answer
904 views

Get errors from WP_Error to different variables

I have added multiple errors in the WP_ERROR. I want to get those errors separately in different variables. With the following code I can get all errors with foreach loop, but how can I assign them to ...
0
votes
2answers
612 views

Featured Image not shown and getting error “Object of class WP_Error could not be converted to int”

First of all I'm using twentyeleven theme, I created a custom template page to insert posts. It has 4 submit forms. it is working well, also setting feature image is ok for 3 forms except the first ...
0
votes
1answer
257 views

Catchable fatal error on 3.6 update

Trying to debug the situation. Getting close, but will need a little help!! Here is the error: Catchable fatal error: Object of class WP_Error could not be converted to string in /home/website/...
0
votes
2answers
923 views

WP_Error not displaying errors

I am trying to utilize WP_Error for my plugin, but nothing happens. Is this too late for WP_Error? Too early? Or am I doing something else wrong? function cpt_pre_post_publish(){ return new ...
0
votes
1answer
1k views

How To Pass Array To get_the_category_by_ID() and Get An Array Back?

I am trying to pass an array of category IDs to get_category_by_ID() in order to get an array of category names back. Since I'm still trying to get this to work I'm just using var_dump() on the output....
0
votes
1answer
834 views

How to generate “WP_Error” Object for user login?

I want to return the Login Error Message even user key-in their privileges correctly. In other words, to terminate the login and show the error message. When we key-in wrong passwords, wordpress ...
1
vote
1answer
2k views

Checking return with WP Error

I've seen other people with similar problems, and I know that I need to check the return when calling for the child items in my custom taxonomy "hhie_artists". I'm not sure how to echo my output to ...
2
votes
1answer
16k views

How to display error messages using WP_Error class?

I have registration form code in my functions.php file like this if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'registration') { $...