1

I am importing a Wordpress site for somebody and I am getting the white screen. In WP_DEBUG it is giving me this error:

Parse error: syntax error, unexpected T_FUNCTION in /wp-content/plugins/edit-guests.php on line 5

Here is the code surrounding line 5:

    <?php
/*
 * Plugin Name: iThemes Exchange Change Guest Customer Email
 */
add_action( 'add_meta_boxes_it_exchange_tran', function () {
    add_meta_box(
        'it-exchange-change-guest-customer-email',
        'Change Guest Customer Email ADdress',
        function ( $post ) {
            if ( ! $post ) {
                return;
            }

Line 5 is the line that starts with "add_action".

I am sure this is a novice's mistake, but any help is greatly appreciated, thank you so much!

Argus Duong
  • 2,356
  • 1
  • 13
  • 24

2 Answers2

0

You're dropping in that anonymous closure function and declaring another function within it:

add_action('wherever_hook', function() {
  # Your Code here cannot contain a function() declaration
  # You will need to declare that function outside of this
});
plushyObject
  • 1,123
  • 6
  • 14
0

Put this correct code after you can check it,

add_action( 'add_meta_boxes_it_exchange_tran',
function () {
    add_meta_box( 'it-exchange-change-guest-customer-email',    'Change Guest Customer Email ADdress',
        function ( $post ) {
            if ( ! $post ) {
                return;
            }}
);});
Priyanka Modi
  • 1,594
  • 1
  • 8
  • 14