Link to own's post on front end (2 posts)

  1. larryoscs
    Posted 1 year ago #

    I've got a site built where everything is done on the front-end. With the exception of admins, no one will ever see the dashboard, ever. But I want a link that someone can click that will allow them to see their own posts in a list style. So, the link for each person would basically be "http://www.my-domain.com/author/(current logged in user)/" It's set up where they can edit their posts on the front end, but I can't figure out how to make the link work. It'll be going in the header and footer, so PHP is fine. It'll be written into an if statement, wherein if the user is logged in, then several lnks will show, including this one I'm trying to build. If not, then the login and register buttons show. Does any of this make sense? Thanks!

  2. Christian1012
    Posted 1 year ago #


    if( is_user_logged_in() ) {
    	$id = get_current_user_id();
    	$url = get_author_posts_url( $id );
            echo '<a href="' . esc_attr($url) . '">My Posts</a>'

Topic Closed

This topic has been closed to new replies.

About this Topic