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

264
Vistas
WordPress - text area linebreaks as seperate P tags (without creating empty p-tags where linebreaks where)

I have a custom textarea are that I normally just output using 'nl2br'. In this particular case I need to wrap them in separate Paragraph tags, instead of have '<br/>'.

I'm currently using this:

$memberDescription = '<p>' . implode('</p><p>', array_filter(explode("\n", get_post_meta( get_the_ID(), 'members_' . $z . '_description', true )))) . '</p>';

My issue is that when I echo this out, it also outputs empty Paragraph tags (im guessing where extra line breaks are).

Any tips or tricks on how to alter this to remove the empty P-tags, or have them not even outputted, to begin with, would be greatly appreciated.

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

0

answer was what @fubar described above:

$memberDescription = '<p>' . implode('</p><p>', array_filter(explode("\r\n", get_post_meta( get_the_ID(), 'members_' . $z . '_description', true )))) . '</p>';
over 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