WordPress.org

Ready to get started?Download WordPress

Forums

translate_user_role() not working in themes (1 post)

  1. Alessandro Benoit
    Member
    Posted 1 year ago #

    I'm trying to translate user roles inside a template but translate_user_role( 'Author' ), which is working fine in admin doesn't work after theme load.
    I tried to track back where the function get his data but a var_dump of get_translations_for_domain( $domain ), inside the template, doesn't give back user roles... Any clue ?!?

    /**
    * Echo the post author role
    *
    * Known issue: The translation is not working on front-end
    *
    * @since 0.0.1
    */
    function ngrigo_post_author_role() {

    global $post, $wp_roles;
    $author_info = get_userdata( $post->post_author );
    echo translate_user_role( $wp_roles->role_names[ $author_info->roles[0] ] );

    }

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by Alessandro Benoit
  • This topic is not resolved
  • WordPress version: 3.5