• I’m trying the following code but it’s not working πŸ™

    I also tried the array function but it didn’t work…

    <?php if (!is_author(8) || !is_author(3)) { ?>
    
    			<p class="blog-info">By <strong><a href="#" title="Title Tag">Anchor</a></strong> in <strong><a href="#" title="Title Tag">Category Anchor</a></strong></p>
    
    			<?php } else { ?>
    
    			<p class="blog-info">By <strong><?php the_author_posts_link(); ?></strong> in <strong><a href="#" title="Title Tag">Category Anchor</a></strong></p>
    
    			<?php } ?>

    I’m trying to create a direct link to an admin/users author page, since I don’t want people knowing what the user names are for these accounts, to prevent hacking.

Viewing 1 replies (of 1 total)
  • Thread Starter truelux

    (@truelux)

    I added this to my functions.php file and it works:

    add_filter( 'author_link', 'admin_author_link', 10, 3);
    function admin_author_link($link, $author_id, $author_nicename) {
        if( $author_id==2 ) {
            $link = 'http://www.yourlink.com/';
        }
        return $link;
    }

    Only problem is, this works with the ID. I’m using Better WP Security so it stripped the admins ID of 1 away, so I don’t know how to add the admin account to the above function.

Viewing 1 replies (of 1 total)
  • The topic ‘How to – If Post by User ID, then Display the following in Category?’ is closed to new replies.