WordPress Fix PHP coding with Theme

[ad_1]

I have a client that asked me to see about fixing their website. I am not a web designer or a expert on wordpress and php but took a look.

The page has two error codes after updating PHP. Currently can’t update the website any further without breaking due to the custom theme itself.

I took a look at the errors on the home page and it shows the following:

Deprecated: Function create\_function() is deprecated

I found the line for the path that it shows. How do I fix the below code to get rid of this error.

// Immediate Return Function
function laborator_immediate_return_fn( $return ) {
$return_fn = ‘return “‘ . addslashes( $return ) . ‘”;’;

if ( is_numeric( $return ) ) {
$return_fn = “return {$return};”;
}

return create_function( ”, $return_fn );
}

and the other error for one of the plugins:

Deprecated: The each() function is deprecated. This message will be suppressed on further calls

Other error:
protected function callActivities() {
do_action( ‘vc_mapper_call_activities_before’ );
while ( $activity = each( $this->init_activity ) ) {
list( $object, $method, $params ) = $activity[1];
if ( ‘mapper’ === $object ) {
switch ( $method ) {
case ‘map’:
WPBMap::map( $params[‘tag’], $params[‘attributes’] );
break;
case ‘drop_param’:
WPBMap::dropParam( $params[‘name’], $params[‘attribute_name’] );
break;
case ‘add_param’:
WPBMap::addParam( $params[‘name’], $params[‘attribute’] );
break;
case ‘mutate_param’:
WPBMap::mutateParam( $params[‘name’], $params[‘attribute’] );
break;
case ‘drop_all_shortcodes’:
WPBMap::dropAllShortcodes();
break;
case ‘drop_shortcode’:
WPBMap::dropShortcode( $params[‘name’] );
break;
case ‘modify’:
WPBMap::modify( $params[‘name’], $params[‘setting_name’], $params[‘value’] );
break;
}
}
}
}

Trying to see if rewriting the code it referring to would get rid of the warning error lines on this homepage. Any assistance would be appreciated.

[ad_2]
1 Comment
  1. The theme is out of date. Update it.

    *” Currently can’t update the website any further without breaking due to the custom theme itself.”* – custom theme? A theme should *always* be updateable – child themes contain customisations.

    And that code looks like WPBakery – it announced a vulnerability affecting vers < 6.13 in Jun ’23, which was fixed with v6.5. I’m guessing your version is older than that since you’re experiencing an old PHP version-related issue which were fixed over a year (or possibly 2) ago.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer