REST API - Head Tags Plugin error with NewsPaper theme

Hello. I came across the same error as mentioned by @mosamlife on my newspaper theme. I have added the workaround script into the function.php file, however it still doesn’t work. the same error still persist. may I know how do I continue?

@eching97 can you switch to Yoast 14 and @frontity/yoast? I think right now it’s a better option.