-1

I have used create_function in my wordpress theme below.

add_filter('document_title_separator', create_function('', 'return "|";'));

and

add_filter('the_generator', create_function('', 'return "";'));

But for PHP 7.3, the create_function() is deprecated.

Any idea, how to fix my codes above on PHP 7.3.

Thanks for your help,

I tried this but it doesn't work :

add_filter('document_title_separator', function() {return |;});

and

add_filter('the_generator', function() {return ;'});
Xiao Wen Tan
  • 9
  • 1
  • 4

1 Answers1

1

there are syntax errors in your code try these:

add_filter('document_title_separator', function() {return '|';});

and

add_filter('the_generator', function() {return ;});

and you can always use the traditional way like this

add_filter('the_generator' , 'my_generator_function');
function my_generator_function(){
    return;
}

tip: use an IDE that notifies you when making syntax errors

Shalior
  • 418
  • 5
  • 9