-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 ;'});
1
  • It worked for me using the answer of @Shalior Thanks for the answer :) Commented Sep 26, 2019 at 23:13

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much, it worked very well for me ! you're the best :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.