I need a way to to have any post with a specific custom field show a js alert when the link to the post is clicked in order to alert the reader that the post contains adult content ahead of the post being loaded for them to read. I need it to be something I can add to my functions.php to make sure all linked post titles check for this custom field and display the alert if the custom field is found.
Khang Minh answers:
You can't do this with functions.php, in my opinion, but rather with the template files you use to show post titles. Are you using jQuery on your site? So you just want to tell your visitors that the post contains adult contents but you don't want to give them any option? You know, like 'Proceed' and 'Nah, I'm still a kid'?
Nilesh shiragave answers:
You cant do this with a filter inside your themes functions.php to achieve this you have to edit all post titles anchor tag you have to add additional class to anchor tag.