Wrap add/remove filter functions
-
In class-amp-related-posts-embed.php the
remove_filter( ‘the_content’, ‘lamvt_add_related_posts’ );
and
add_filter( ‘the_content’, ‘lamvt_add_related_posts’ );need to be wrapped in a function_exists() call:
if (function_exists(‘lamvt_add_related_posts’)) {
remove_filter( ‘the_content’, ‘lamvt_add_related_posts’ );
}if (function_exists(‘lamvt_add_related_posts’)) {
add_filter( ‘the_content’, ‘lamvt_add_related_posts’ );
}Otherwise it yields the warning:
PHP message: PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘lamvt_add_related_posts’ not found or invalid function name
- The topic ‘Wrap add/remove filter functions’ is closed to new replies.