WordPress customizer Preview not loading

I'm creating a WordPress website, today I have tried to add some new features but I'm not able to add because customizer live preview is not loading I have done some steps Update all theme and plugin uninstall all the plugin after some time again install all plugin one by one. 3)Take a back up of whole site and reset the website by "WP reset plugin" upload again after sometime. Check the hosting space but not the space problem. check …
Category: Web

Button doesn't work in the profile panel

Can anybody help me out? Currently, I'm having trouble with the Set New Password button in the Profile section of the admin panel. The button is not responsive and nothing happens when clicking. I'm not sure though, but my wide guess is it has occurred after using some caching plugins like combine CSS/JS and inline stuff for site loading speed optimization. I deactivated all and re-tried it though, it's still the same. Plus, the Update button at the top of …
Category: Web

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 converted to string in C:\wamp64\www\wordpress\wp-includes\ms-functions.php on line 206. What do I need to do to make this work? This is my code: $domain = ""; $path = "localhost/wordpress/wp_4"; $title = "WP_4"; $user_id = 1; $network_id = get_main_network_id(); $role = 'editor'; $new_blog_id = wpmu_create_blog($domain, $path, $title, $user_id, $network_id); add_user_to_blog($new_blog_id, …
Category: Web

"Welcome to WordPress" Plugin Required Error

I'm getting this error every time I install or update a plugin on WordPress. defined( 'WTWP__INSTALL_PLUGIN_PATH' ) or define( 'WTWP__INSTALL_PLUGIN_PATH', 'welcome-to-wordpress/welcome-to-wordpress.php' ); function install_wtwp() { global $pagenow; if ( !( 'install.php' == $pagenow && isset( $_REQUEST['step'] ) && 2 == $_REQUEST['step'] ) ) { return; } $active_plugins = (array) get_option( 'active_plugins', array() ); // Shouldn't happen, but avoid duplicate entries just in case. if ( !empty( $active_plugins ) && false !== array_search( WTWP__INSTALL_PLUGIN_PATH, $active_plugins ) ) { return; } $options …
Category: Web

Fatal error in wordpress htdocs

I need help with this Fatal error: Array and string offset access syntax with curly braces is no longer supported in /homepages/25/d502821911/htdocs/...../wp-includes/script-loader.php on line 757
Category: Web

Critical error - can't post comments

I've been building a website (not a professional and don't know much about coding). Everything looks good, except for I can't post comments on my blog posts. I get a "critical error" message. Please see below and please advise. I'm using the Blocksy theme and Gutenberg builder. I also recently migrated my website from one hosting provider to another, not sure if that's relevant, but I'm working in a staging environment and it doesn't work there either. I've removed the …
Category: Web

How to ignore WP_ERROR caused by "get_the_excerpt" method in an AJAX call?

function get_post_data(){ $post_id = $_POST['post_id']; ... $data['title'] = get_the_title( $post_id ); ... $data['excerpt'] = get_the_excerpt( $post_id ); ... echo json_encode( $data ); wp_die(); } The above code shows the scheme of the ajax call. Some data should be retriven from a post given by its ID outside the LOOP. This seems to work when the content fields like title and excerpt not empty. But when empty I get an Internal Server Error (500: admin-ajax.php not found). When I debug the …
Category: Web

Question about error display in wordpress

Is it possible to display the basic errors on the page rather than with wp_die? For example, display the "please enter a comment" error above the form rather than landing on the wp_die handler? I've been running for quite a while in the wp-includes folder with the files: wp-comment-post.php, comment-template.php, comment.php I also had a reaction with this piece of code the error is displayed all the time. But anyway when I send the form I still arrive on wp-comment-post.php …
Category: Web

WordPress admin panel not working

Today I added all the codes to the new server and I am getting the issue like the below image. WordPress admin panel not working. I tried below code define('CONCATENATE_SCRIPTS', false); then I am getting the CSS and admin panel is also looking same but If I click on any link then I am getting below error
Category: Web

WordPress notification reports

I had to make a standalone dashboard for WordPress. I designed an interface to notify users of information messages (eg wrong user password) such as verification of forms and files or errors. But I have to carry messages just like wordpress. It is carrying messages in the WordPress admin panel with I guess (transients). (1) Is this true or did I get it wrong? NOTE: As far as I know WooCommerce also uses a similar method while giving an error …
Category: Web

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. If both are ok, I want to insert the comment. Here's my code: <?php global $current_user, $post; if( isset( $_POST['send'] ) && isset( $_POST['test_nonce'] ) && wp_verify_nonce( $_POST['test_nonce'], 'testify_nonce' ) ) { //global $error; $error = new WP_Error(); $comment_content = $_POST['comment_content']; if( empty( $comment_content …
Category: Web

How can I add hyperlink in WP_Error message?

I using below code for showing error message to users in my WordPress website if ( $wp_error ) { return new WP_Error( 'you_cannot_vote_on_restricted', __( 'Voting on restricted posts are not allowed.', 'anspress-question-answer' ) ); } Now I want show error message to users with hyperlink. I use below code to do that, But this code showing just text if ( $wp_error ) { return new WP_Error('no_permission', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>'), site_url('wp-login.php?action=lostpassword', 'login'))); } …
Category: Web

How to customize the critical error message?

How to customize the critical error message saying: There has been a critical error on your website. Learn more about debugging in WordPress. Instead of using CSS to hide the message it would be interesting to be able to point the link to another source than the community article.
Category: Web

Why when I instantiate wp_error in a validation method my user registration method stops working?

I would really, really, appreciate any insight I can get here. I'm working on a WordPress plugin that registers users in WordPress and want to validate data submitted through the form. I have a class for this, here's a condensed version of it: namespace PluginName\Includes\Forms\Classes; class Validation { public function validate_fields($field, $form_type){ $errors = new WP_Error(); $validated_fields = []; if(!is_email($field)): $errors->add('not_email', __('Entered an invalid email', 'plugin-name')); else: $validated_fields['user_email'] = $field; endif; //other validations $error_code = $errors->get_error_code(); if(!empty($error_code)): return $errors; endif; …
Category: Web

Cannot use object of type WP_Error

function im_add_new_term($name,$tax){ if($tax == "genre"){ return wp_insert_term($name,$tax,array("slug"=>array_search ($name, $genres)))["term_id"]; } else { return wp_insert_term($name,$tax)["term_id"]; } } Fatal error: Cannot use object of type WP_Error as array in /home/pcodecom/demo.p30code.com/multimedia-2/wp-content/plugins/imdb/imdb.php on line 11
Category: Web

error Trying to get property of non-object and Cannot use object of type WP_Error as array in

function im_check_term($name,$tax){ $term = get_term_by("\x6e\x61\x6d\x65", $name,$tax); return !is_wp_error($term) ? $term->term_id : false; } function im_add_new_term($name,$tax){ if($tax == "\x67\x65\x6e\x72\x65"){ return wp_insert_term($name,$tax,array("\x73\x6c\x75\x67"=>array_search ($name, $genres)))["\x74\x65\x72\x6d\x5f\x69\x64"]; } else { return wp_insert_term($name,$tax)["\x74\x65\x72\x6d\x5f\x69\x64"]; } }
Category: Web

WP_Fatal_Error_Handler OR WP_Error OR try/catch

A process into my plugin provoke a fatal error in Linux Server which I have not access, for example to define a WP_DEBUG_LOG. I could identified the conflict in the event related to generate an jpeg image from a graph (jpgraph - CanvasGraph()). What I'm looking for : First, extract any-to-specific info from the server or wordpress, that I can see in the response (like the string wordpress tipically send "../article/debbugin-in-wordpress/">learn more about wordpress debbuging") to figure out whats the …
Category: Web

To stylize WP_Error messages or not?

I hate, despise forcing markup/stylization on anyone that extends my system because I'm making assumptions about how my code is going to be used and force people to play around my decision-making. Thing is, I'm now faced with an issue. I have a really long WP_Error message, it's like 100 salamis all put together long. I kinda wanna insert a \r\n between these messages to make it readable. Is there no middle-ground? I'm also offering these messages separated in the …
Category: Web

Return WP_Error as WP_REST_Response

I have a http request to WP REST API that can resolve in a success or a failure status The success gets handled by WP_REST_Response, and if any error occurs this is handled by WP_Error, both returned if that's the case However, in both cases when I receive the server response I don't get any of the messages I've added public function myFunction($request = null) { $response = array(); $parameters = $request->get_json_params(); $error = new WP_Error(); if (success) { $response['code'] …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.