Uncaught Error: Call to a member function get_slider_language() - wordpress

I'm attempting to move my wordpress sites over to Google Cloud, I've moved two successfully with revslider - the third had a bloated database and I needed to trim some fat to get it in.
I'm now getting the following error when trying to view a slide from any of the front-end pages.
Fatal error: Uncaught Error: Call to a member function get_slider_language() on null in /var/www/rr/wp-content/plugins/revslider/includes/output.class.php:675 Stack trace: #0 /var/www/rr/wp-content/plugins/revslider/includes/output.class.php(634): RevSliderOutput->add_slider_base() #1 /var/www/rr/wp-content/plugins/revslider/revslider.php(96): RevSliderOutput->add_slider_to_stage('new_home', '', '', '', '') #2 /var/www/rr/wp-includes/shortcodes.php(343): rev_slider_shortcode(Array, '', 'rev_slider') #3 [internal function]: do_shortcode_tag(Array) #4 /var/www/rr/wp-includes/shortcodes.php(218): preg_replace_callback('/\\[(\\[?)(rev_sl...', 'do_shortcode_ta...', '[rev_slider sli...') #5 /var/www/rr/wp-content/plugins/js_composer/include/helpers/helpers.php(240): do_shortcode('[rev_slider sli...') #6 /var/www/rr/wp-content/plugins/js_composer/include/templates/shortcodes/vc_column.php(94): wpb_js_remove_wpautop('[rev_slider sli...') #7 /var/www/rr/wp-content/plugins/js_composer/include/classes/shortcodes/core/class-wpbakerys in /var/www/rr/wp-content/plugins/revslider/includes/output.class.php on line 675
There has been a critical error on your website.
Learn more about debugging in WordPress.
I've attempted the following steps to no avail.
Switched theme.
Disabled all plugins.
Deleted all slides and attempted with a freshly made slide.
Updated all plugins, including deleting Slider Revolution entirely and reinstalling the latest version.
I removed some language packs from the VM in an attempt to claw back some space and thought that might've been it - but reinstalling with apt-get -y install "check-language-support -l en" doesn't seem to have helped.
Updated to PHP 7.4.8
I'm using a Google Cloud VM with OpenLiteSpeed, and MySQL+Redis. I changed the only relevant option I could see in Slider Revolution Global Config from using default as the language to en. The slide works as expected in preview mode within the admin panel.

This is caused by what appears to be a bug in the Revolution Slider plugin, at least as of v6.2.21 (and it doesn't appear to have been fixed since). In revslider/includes/output.class.php:678 it calls
$lang = $rs_wmpl->get_slider_language($this->slider);
but if the WPML plugin is not installed, then $rs_wmpl is null.
Until they fix it you can hack the plugin to check for null, e.g.,
//set slider language
if($this->get_preview_mode() == false && !empty($rs_wmpl)){
$lang = $rs_wmpl->get_slider_language($this->slider);
$this->change_language($lang);
}
Edit: This bug doesn't reproduce under ordinary page loads, but does reproduce when loading the site under WP-CLI, e.g., via wp profile. Suspect it has something to do with the way global variables are handled in that case.

Related

WordPress function undefined when adding a shortcode

We would like to add a custom function of a shortcode in wp_include/functions.php.
This is the function:
function url_id() {
$apiUrl = 'https:exampleurl.api.com/exemple123';
$response = wp_remote_get($apiUrl);
return wp_remote_retrieve_body($response);
}
add_shortcode('session_id', 'url_id');
But we were getting this error:
There has been a critical error on this website.
Learn more about troubleshooting WordPress.
After reading some more troubleshooting documentation we added these two lines in wp-config:
define( 'WP_DEBUG', true );
define( 'WP_CACHE', true );
And after that we are getting this error:
Fatal error: Uncaught Error: Call to undefined function add_shortcode() in /home/c1624672c/public_html/woo/wp-includes/functions.php:18 Stack trace: #0 /home/c1624672c/public_html/woo/wp-settings.php(111): require() #1 /home/c1624672c/public_html/woo/wp-config.php(104): require_once('/home/c1624672c...') #2 /home/c1624672c/public_html/woo/wp-load.php(50): require_once('/home/c1624672c...') #3 /home/c1624672c/public_html/woo/wp-blog-header.php(13): require_once('/home/c1624672c...') #4 /home/c1624672c/public_html/woo/index.php(17): require('/home/c1624672c...') #5 {main} thrown in /home/c1624672c/public_html/woo/wp-includes/functions.php on line 18
There has been a critical error on this website. Learn more about troubleshooting WordPress.
If you want to add custom shortcodes to your website, that can be done via a custom plugin, or in your theme (as I suspect you're trying to do).
Instead of editing wp-includes/functions.php, add your code to wp-content/themes/<name-of-your-theme>/functions.php.
You should never edit the core files of WordPress, which includes all files in /wp-admin and /wp-includes. When you upgrade WordPress in the future, these files will be overwritten, and you'll lose any changes you've made.
The error message occurs because you're attempting to use the add_shortcode() function before WordPress has fully loaded, and defined all available functions.
Please change the shortcode parameter session_id because session_id predefined function in wordpress see the blow or your code
add_shortcode('session_id', 'url_id');
But right code will be work when you change the session_id.

WP Contact form is not working, Spinning wheel forever after submitting form

I have created a contact form on our website, I thought it worked in the past, but now when you click the submit button nothing happens and a blue spinning wheel comes up and nothing happens.
Does anyone know what it can be? Some manage to fix it by deleting the password-protect plugin but I do not have that enabled.
Java error from console
Link to the website with the contact form: https://www.hamarbilpleie.no/kontakt-oss/
Dubug plugin result
[03-Mar-2021 20:31:48 UTC] PHP Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/2/h/hamarbilpleie/www/wp-content/themes/carservice/contact_form.php on line 261
[03-Mar-2021 20:31:48 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to cs_phpmailer_init() must be an instance of PHPMailer, instance of PHPMailer\PHPMailer\PHPMailer given, called in /home/2/h/hamarbilpleie/www/wp-includes/class-wp-hook.php on line 287 and defined in /home/2/h/hamarbilpleie/www/wp-content/themes/carservice/functions.php:298 Stack trace:
#0 /home/2/h/hamarbilpleie/www/wp-includes/class-wp-hook.php(287): cs_phpmailer_init(Object(PHPMailer\PHPMailer\PHPMailer))
#1 /home/2/h/hamarbilpleie/www/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
#2 /home/2/h/hamarbilpleie/www/wp-includes/plugin.php(551): WP_Hook->do_action(Array)
#3 /home/2/h/hamarbilpleie/www/wp-includes/pluggable.php(494): do_action_ref_array('phpmailer_init', Array)
#4 /home/2/h/hamarbilpleie/www/wp-content/themes/carservice/contact_form.php(280): wp_mail(Array, 'Foresp\xC3\xB8rsel fr...', 'F\xC3\xB8lgende henve...', Array)
#5 /home/2/h/hamarbilpleie/www/wp-includes/class-wp-hook.php(287): cs_theme_contact_form('')
#6 /home/2/h/hamarbilple in /home/2/h/hamarbilpleie/www/wp-content/themes/carservice/functions.php on line 298
Probably you are having a bug in Javascript. What you have to do is, open up the Developer Tools in your browser, then goto Console tab. You would find the error messages there. Copy that error and share it with us.
EDIT
I can see that there's a 500 Internal Server Error (based on the screenshot you provided) when the data is submitted to the server. What you have to do is, see if there's any error log created inside your server. It would have some information regarding what is causing the issue. Please share it with us. If you are not able to see it, please follow this: Debugging in WordPress
EDIT 2
It appears that you are having two issues in your theme's functions.php file. It's using one depreciated function and for the other probably because of old code. The line numbers are #261 and #298 (/wp-content/themes/carservice/functions.php). The easy would be to ask your theme developer to get it fixed for you. If you have the update available for your theme and plugins, make sure you update it. Kindly note that, if you have done any modifications on the functions.php file, instead of doing it in a child theme, those changes would be overwritten when you update the theme.
After some digging and discussion, I found out that the theme had not been updated for ages. But to find an update for this was not easy. For some reason, it did not automatically update from WP. But it is fixed now. Thanks for the tips and hints, guys.

When trying to preview a theme - The site is experiencing technical difficulties. Please check your site admin email inbox for instructions

When trying to preview a new theme for my blog, this appears...
The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.
I didn't receive an email though. I've tried deactivating all of my plugins and this didn't work. Any ideas? I'm new to this.
You should detect the error before do anything.
Turn on WP debug mode and you will see what error do you have:
In wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
More information about WP debugging: https://wordpress.org/support/article/debugging-in-wordpress/
Website/Admin is displaying "The site is experiencing technical difficulties. Please check your site admin email inbox for instructions."
This was my solution for our website. I only fixed enough issues for the admin page to start working again.
This was all done after I fixed my initial site issues that crashed the entire site, addressed in this question: https://stackoverflow.com/a/65357857/14850513
After I made those fixes, the admin page was still giving the previously stated error message that you described, so here is how I fixed it. The following bullets are all of the error messages I faced and how I fixed them. This may not solve everyone's issues but these were the specific ones I faced.
Go to the public.html/wp-config.php
go to the following line and change debugging to true
define('WP_DEBUG', false); #Change to true
This will show all of the errors that are causing the site to have issues. You must address them until it begins to function again. You will know because it will start working the next time you refresh.
ERROR 1: Array and string offset access syntax with curly braces is deprecated
Follow to each line listed and change '{}' to '[]'
ERROR 2: Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home1/seth/public_html/wp-content/plugins/revslider/includes/operations.class.php on line 2364
I open the php file at the problem line, I changed the term [continue;] to [break;]
ERROR 3: "Deprecated: Function create_function() is deprecated in xxx.php" on 258 line
Changed
public static function registerWidget($widgetName){
add_action('widgets_init', create_function('', 'return register_widget("'.$widgetName.'");'));
}
to
public static function registerWidget($widgetName){
add_action('widgets_init', function () use ($widgetName) {
return register_widget($widgetName);
});
}
ERROR 4: Fatal error: Uncaught Error: [] operator not supported for strings
the failing line was:
self::$arrMetaBoxes[] = $box;
The fix is to add the following line right before it
self::$arrMetaBoxes = [];
My admin page started working at this point, but you may need to continue fixing errors until it begins to function properly again.

White screen on the frond and the back end of my wordpress site?

my website shows a white screen in the frond and in backend, the only changes that i made, was some updates yesterday , i tried to restore from the bluehost but it is the same issue, in the error log it shows this error:
[28-Aug-2018 07:10:16 UTC] [28-Aug-2018 07:10:16 UTC] The
WC_Cart::get_cart_url function is deprecated since version 2.5.
Replace with wc_get_cart_url. [28-Aug-2018 07:10:16 UTC]
add_to_cart_fragments is deprecated since version 3.0.0! Use
woocommerce_add_to_cart_fragments instead.
what can i do to fix it, i sell bags and this days, many people are buying from my website
A plugin may be causing this. Have you tried deactivating all of your plugins? If you can't get into your site, you could do this through the server and deactivate them one by one to figure out if a particular one is causing this.
Although it seems that the function '$link = wc_get_cart_url();' is now deprecated so you can try changing this to '$link = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : $woocommerce->cart->get_cart_url();' in this file /config-woocommerce/config.php
Alternatively, you can check other solutions here.

"Undefined property: stdClass"

This error suddenly occurred when Pressflow was added to our Drupal installation. It is coming from a custom module that, prior to Pressflow seemed to work fine. After the addition of Pressflow, running Drush causes this error to display on screen.
The function that is identified as the source of the error looks like this:
function user_search_location_get(&$user) {
if (count($user->user_location_pref)) { // This line is causing the error.
return $user->user_location_pref;
}
// …
}
The error message is the following:
WD php: Notice: Undefined property: stdClass::$user_location_pref in user_search_location_get()
Short answer, in your custom module, you should check if that property exists before you count it. That, or make sure the $user object has that property before you use it.
if (isset($user->user_location_pref) && count($user->user_locaion_pref) > 0) {
return $user->user_locaion_pref;
}
While it is a little more work, when you start developing with notices turned on, you will find errors in your code that otherwise would have not appeared till later, and would have been more difficult to track down.
In your previous environment or install, the PHP error reporting was probably set to not show notices. While I recommend keeping notices on and making your code work with them, you can turn them off through the Drupal 7 UI. Configuration -> Development -> Logging and Errors. Then set the value to 'Errors and Warnings' ... Otherwise, you can set your error reporting level in your php.ini to report all except notices.
Note that Drupal 6 did not force notice reporting on, while Drupal 7 does. That prompts this type of question a lot.
If this is your only notice issue though, it makes more sense to just correct your custom module.

Resources