Pergunta

Estou tentando filtrar todas as tags dentro de uma postagem no wordpress usando strip_tags().Eu configurei assim:

<?php
// The Query
echo date ("Y");
query_posts( 'p=10' );
// The Loop
while ( have_posts() ) : the_post();
$footertext = the_content(); 
echo strip_tags($footertext);
endwhile;
// Reset Query
?>

Isso não parece remover as tags da maneira que eu esperava.

Foi útil?

Solução

Mudar the_content() para get_the_content().

the_content() é usado para gerar diretamente o conteúdo, enquanto get_the_content retorna o conteúdo a ser armazenado na variável para processamento posterior.

$footertext = get_the_content(); 
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top