Home Forums WTI Like Post PRO Author Liked Posts Template in Woo Commerce My Account page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #200

    I am using Woo Commerce, and I have substituted their My Account page for the standard WordPress author page. In order to get the content-likes.php template part to work right, I needed to edit the way it passes the current user object to $author. This is what I did in order to use that template part in the My Account page:

    // $author = get_user_by( 'slug', get_query_var( 'author_name' ) );
    $author = wp_get_current_user();
         if ( !($author instanceof WP_User) )
    • This topic was modified 9 years, 9 months ago by rendition.

    I am not sure if I understood your question correctly or not but if you are trying to get the current logged in user’s id, then you can use the following code and then use that value.

    $author = wp_get_current_user();
    $user_id = (int)$author->ID;

    If this is not what you wanted, then can you please explain this in details?

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘WTI Like Post PRO’ is closed to new topics and replies.