I am trying to override a plugin that creates SEO headers in wordpress. The filter does the job, but I need to create headers dynamically. So I create a header and then pass it to an anonymous function. I could have another function that creates headers, it will definitely be cleaner ...
It works
function seo_function(){ add_filter('wpseo_title', function(){ return 'test seo title'; }); }
Is not
function seo_function(){ //create title above $title="test seo title"; add_filter('wpseo_title', function($title){ return $title; }); }
Thanks for any help
Joe
Without using an anonymous function example, this works, but I still canโt pass the variable, I will have to duplicate the code to create a header.
Seo_function () {
//create title above $title="test seo title"; add_filter('wpseo_title', 'seo_title'); } function seo_title(){ $title="test"; return $title; }
source share