Check from functions.php if function exists in footer.php

I am trying to secure the copyrights links from footer.php file and I want to create a function in footer php which will have those links and then I want to check from functions.php if that function exists in the footer and in case it doesn't I would like to show an exit(); function. I am also planning to encode the footer and functions php code.

I tried function_exists() but it works only if the function I am checking is in the same file as function_exists is. Can anybody give me any idea on how to solve this? Tank you!

Topic function-exists footer functions Wordpress

Category Web


You should not declare functions in your templates. The templates are for outputting content. The function_exists() will check if the function is declared before the function_exists() call, not after it, and templates are loaded after functions.php file, since you can control them by using the template_redirect filter.

Declare your function in your theme's functions.php file, and then call it in your template. This is the best way to go.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.