The best way to do this (I don't approve of this method but I this is a different discussion) is to add your footerlink to wp_footer()
, like that:
function your_link() {
echo '<a href="#">Your Link</a>';
}
add_action('wp_footer', 'your_link');
You still don't have any prove that the Link exists and is not deleted. So set a transient in your function:
function your_link() {
echo '<a href="#">Your Link</a>';
if ( !get_transient( 'check_my_footer_link' ) {
set_transient( 'check_my_footer_link', 'is_there', 600 ); //expires after 600 seconds
}
}
add_action('wp_footer', 'your_link');
Now you have a transient telling you, if the footerlink was called in the last 600 seconds.
The next step would be the message to the user, wherever you want to display the message, or if you want the site to die or whatever. I go with wp_mail()
now, because you can use every kind of message to inform the user, from wp_mail
to another footernote or anything else.
So, adding the messagefunction to your sites admin panel:
function messagefunction() {
if ( get_transient( 'check_my_footer_link' ) != "is_there" ) {
wp_mail( get_bloginfo( 'admin_email' ), 'You deleted the Footer Link', 'Bad Move' );
}
}
And call this function in the functions.php or any other file from your theme.
This method has a few drawbacks, as it could be that the site was not visited for 600 seconds, so the transient does not exist anymore. You could implement a counter for that (set an incrementing option 'views_of_site_without_footerlink'
, and just send the message if it is bigger than 1, and set it back to zero if the footer link is displayed).
Remember that it is not 100% safe, beacuse if a developer removes the notification stuff as well, it won't work anymore.