I have been reading in the codex about the read more issue. It says when using the_excerpt, the character limit is 55 and then the read more should display which should look like this [...]

I am not seeing that in my excerpt. I have also tried several filters for testing.

function custom_excerpt_length( $length ) {
    return 20;
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

function new_excerpt_more( $more ) {
    global $post;
    return '<a class="moretag" href="'. get_permalink($post->ID) . '">Read the full article&hellip;</a>';
add_filter('excerpt_more', 'new_excerpt_more');

Neither of them work. I found that if I post the information in the content and use the more button which makes the <!--more--> then I see a link for the more button. I don't want to have to push that every time. So I looked up some posts on here but didn't find anything that helped. So I was wondering if I am doing something wrong in my query.

// The Query
$the_query = new WP_Query( array( 'category_name' => 'news', 'order' => 'ASC'));

// The Loop
while ( $the_query->have_posts() ) :
    global $more;
    $more = 0;
            if ( has_post_thumbnail() ) {
                ?><figure><?php the_post_thumbnail('news'); ?></figure>
            <?php } ?> 
            <!----------/ TITLE /---------->
            <em><?php the_title(); ?></em>
            <!----------/ DATE /---------->
            <strong><?php the_date(); ?></strong>
            <!----------/ PARAGRAPH /---------->
                <?php if( has_excerpt()){
                } else {
                        the_content('Read More'); 
                } ?>
            <!----------/ BUTTON /---------->
    // Restore original Query & Post Data
    wp_reset_postdata(); ?>

All my research says that the filters should work or adding stuff into the content should work. Things like:

 the_content( 'Read More' );

Is there something I am missing? I want to get the excerpt working so that I can limit the word count and automatically insert the read more link.

  • 1
    Are you using the excerpt meta box? If you enter text in there, it will override the <!--more--> tag and the word trimming
    – shea
    Jan 16, 2013 at 2:13
  • Also, "read the full article" and similar are not added to custom excerpts using the meta box
    – shea
    Jan 16, 2013 at 2:14
  • I am using the excerpt box under the post box in the edit post page. all reading suggests that adding more than 55 words or even adding the filter will then add a link to read more. The codex says that the_excerpt() does not automatically add a read more link so you need to add the code for a button under the excerpt which I have done. I have added the filter to limit the words to 20 but when I paste more than 55 words in the excerpt box, the entire text shows and I can't see the button because it breaks layout and is hidden. This is a page template. Does it matter it's not the home page?
    – Jamie
    Jan 16, 2013 at 2:17

1 Answer 1


I think if( has_excerpt()) return false that's way its return full content remove condition and only use the_excerpt() then it will work.

I have another solution that i use :)

$content = get_the_content();
$short_content = implode(' ', array_slice(explode(' ', $content), 0, 10));
echo $short_content;

this function returns 10 words of post. after echoing content you can add button code like

<a href="<?php the_permalink(); ?>" >read more ...</a>

now you cant't use <!--more-->

  • 1
    I tried removing the conditional before posting and it still didn't work. I don't know what the issue is. Most everything the codex says does not work in this template. I am wondering if it is because I am running multiple custom loops in the site and the query doesn't know which query to filter or something. I tried your option 2 with the custom function and that seems to work good. So I am just going to use that. thank you for posting.
    – Jamie
    Jan 17, 2013 at 1:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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