2

This is such a simple question it seems yet I can't find a definite answer on it.

So how do you make get_the_content() obtain all the content of a post even if it has <!--more--> inside of the text which normally makes the function return after it has been used ?

6

I would just get the raw content from $post->post_content, strip the <!--more--> and then do whatever you need with the result. Just remember, $post->post_content and get_the_content() both return unfiltered text, if you need filtered content, simply apply the the_content filter to the result from those two results

EXAMPLE inside the LOOP

global $post;
$unfiltered_content = str_replace( '<!--more-->', '', $post->post_content );
// If you need filtered content returned
$filtered_content = apply_filters( 'the_content', $unfiltered_content );
// Output filtered content
echo $filtered_content;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.