• Resolved Thomas

    (@undersound)


    Hi there…
    I’m searching since 3h for a solution.
    As many others i use a custom post type named “fotogalery”.
    Within there is the category “Fotograf” with the list of the photographers.

    Now im on the page of one of the photographers (the url is like /wordpress/fotograf/nameof-thephotographer/).
    Through the Code

    $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
    echo '<br />Term Name:'.$term->name.'<br />';

    i get the term name, which is equal to the photographers name.
    As example:

    url: /wordpress/fotograf/ingo-mayer/
    term: Ingo Mayer

    Name: Ingo Mayer

    Is it possible to get the ID of Ingo Mayer by his name?
    Note: he is not the author of pages or posts displayed.

    I need it to view the profile of the photographer through the UPME Shortcode [upme id=X]…

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

    (@undersound)

    $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
    $userslug = $term->slug;
    $user = get_user_by( 'slug', $userslug);
    $userid = $user->id;
Viewing 1 replies (of 1 total)
  • The topic ‘Get the user id using his name’ is closed to new replies.