How to redirect a Wordpress logout to custom URL


Staff member
I have scoured the web for the last 45 minutes and still not found a simple description of how to send a user, logging out of WordPress, to a custom URL.

I've come across <a href="" rel="nofollow noreferrer">this</a>;

add_filter( 'logout_url', 'my_logout_url' );
    function my_logout_url( $url ) {
       return '';

..but it does not describe where to paste that code. And i am not using a 'members' plugin.

Surely there is just something that can be added to the Theme functions.php file or a edit to general-template.php to specify a URL? I'm not even wanting a different site domain. Just back to the login page would be fine, but I would rather be able to specify an entire custom 'link' somewhere in the code.

How/where can I do this?

Many thanks in advance for yor help or advice