How to automatically nofollow a set domains? (I seem to have half of the answer)

Instead of the linked option you could just go with something using jQuery. Try adding something like this to your primary theme or plugin javascript file. (Usually something like main.js.)

jQuery( document ).ready( function($) {
    $( 'a[href^="https://google.com"], a[href^="https://yahoo.com"]' ).each( function() {
        $( this ).attr( 'rel', 'nofollow' );
    } );
} );

For any additional URLs you’d simply keep adding a[href^="https://domain.com"] in a comma separated format into the selector.

tech