• Resolved JS Morisset

    (@jsmoriss)


    You may already be aware of this, but there does not seem to be a way (that I’ve found) to get the title for a user ID, like you can for a post ID or term ID. For example:

    
    $tsf = the_seo_framework();
    
    $args = array(
        'id'       => {post or term ID}
        'taxonomy' => {term taxonomy}
        'pta'      => {post type for post type archive}
    );
    
    $title = $tsf->get_title( $args, $escape = false, $social = true );
    

    Is there an additional argument to get the title for a user ID that I’m not aware of?

    Thanks,

    js.

Viewing 1 replies (of 1 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hi JS,

    Since we have no user-interface for users, there is no need for TSF to implement such a feature internally. Such a feature, like I added for “post type archives,” adds much complexity; the reason I postponed that for 5 years.

    “This feature took 14 days, 140 hours, 15 commits, and 100 file changes to complete.”

    In any case, for author titles, on the front-end, TSF simply uses

    $title = \get_queried_object()->display_name ?? '';
    

    I have no plans to add more fields to author profiles for the near future (read: at least two years). So the native WordPress method should do.

    P.S. array() is not a function, it’s a language construct: []. 🙂

Viewing 1 replies (of 1 total)

The topic ‘Cannot get_title() for user ID.’ is closed to new replies.