Leave a Reply

1 comment

  1. There is no need to change the the_author() function itself. A simple conditional tag will do the trick. Example:

    <?php
    
    /*** on your functions.php file ***/
    function ifRegistered() {
        if(is_user_logged_in()) {
            the_author();
        } else {
            echo get_the_post_meta($post->ID, 'your_post_meta_key', true);
            // or anything else, of course
        }
    }
    
    /*** on the template you want to use the function  **/
    
    // your HTML markup ...
    
        ifRegistered();
    
    // more possible HTML ...
    
    ?>
    

    Hope that helps!

    EDIT: Updated the function.