Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
How to pass User First Name & ID in a Javascript tag in WordPress Backend?

I am trying to connect usetiful to my WordPress Backend.

I need to tag the users and pass information to Usetiful for further personalization.

After going through various similar Q/A threads, I managed to retrieve and pass the User ID to Usetiful, but having trouble getting the User First Name.

Here is the Code Snippet that I am using (Adding code to the Code Snippets Plugin)

<script>
window.usetifulTags = { userId : <?=get_current_user_id() ?>, firstName : <? $user_info = get_userdata(get_current_user_id());$first_name = $user_info->first_name;return $first_name;?>;};

The get_current_user_id() works well, but unable to get the User First Name/Display Name

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Since this is a text, you need to wrap some quotes around it and you should make sure your PHP is a proper value to be evaluated. If you have more operations to be performed, then it is to be recommended to implement a function and only call the function.

<script>
window.usetifulTags = { userId : <?=get_current_user_id() ?>, firstName : "<? $first_name = get_userdata(get_current_user_id())->first_name ?>"};
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda