1

My wordress plugin is giving some issue. I am using 8.2 PHP version but the plugin is very old.

define('BBP_BBCODE_PATH', WP_CONTENT_DIR.'/plugins/'.plugin_basename(dirname(__FILE__)) );

//Admin options
include(BBP_BBCODE_PATH.'/bbpress2-bbcode-admin.php');

//Classes
include(BBP_BBCODE_PATH.'/class_bbpress2-bbcode.php');

// Start this plugin once all other plugins are fully loaded
add_action( 'plugins_loaded', create_function( '', 'global $BBCode; $BBCode = new BBCode();' ) );
?>

The problem is with this code - add_action( 'plugins_loaded', create_function( '', 'global $BBCode; $BBCode = new BBCode();' ) );

Can anyone please help me to fix this issue

1
  • 1
    create_function was removed from PHP back in 8.0, 3 years ago. This plugin is effectively dead in the water.
    – vancoder
    Commented Dec 8, 2023 at 19:48

1 Answer 1

1

You are going to want to edit this line:

add_action( 'plugins_loaded', create_function( '', 'global $BBCode; $BBCode = new BBCode();' ) );

You will want to make yourself an actual function. Probably something like this:

function my_hacked_function(){
    global $BBCode; 
    $BBCode = new BBCode();
}
add_action( 'plugins_loaded', 'my_hacked_function');

I've not tested this. However, this is the general direction you will want to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.