Archived topic
Read more link
9 replies · Started by Matthew on November 27, 2018
Hi there
I noticed that GeneratePress is including a "Read more" link after every excerpt, even though I have this disabled its not appearing on the site but it is appearing in the code.
This is a lot of unnecessary code, links and surely could be seen as bad from an SEO perspective? As it looks like hidden links.
Is there a way to stop it from including this code?
Thanks.
Hi there,
How are you outputting those posts? Are you using a plugin?
Hey Tom
Using Toolset, on our old theme though (PenNews) using Toolset it didn't do this. Which is what led me to think its to do with GP?
Well, GP does add a read more link using the core GP filter. I suppose you could try removing it?:
remove_filter( 'excerpt_more', 'generate_excerpt_more' );
Hey Tom
Hmm that didn't seem to do the trick. Any other ideas?
Should I ask Toolset or is this nothing to do with them really?
Maybe try this:
add_action( 'wp', function() {
remove_filter( 'excerpt_more', 'generate_excerpt_more' );
} );
Hi Tom,
Hmm no luck with that either. Could it be because its a custom post type? Just guessing here.
Hmm, worth giving this a shot too..
remove_filter( 'excerpt_more', 'generate_blog_excerpt_more', 15 );
remove_filter( 'the_content_more_link', 'generate_blog_content_more', 15 );
Ideally, it would be best to apply this to those posts only, but I'm not sure if Toolset allows for that?
That worked! :)
This does apply across the site but is that really a bad thing? If we want to display the read more link I can just manually code this to display after the excerpt.
Or is there some disadvantage I am unaware of with this being applied across the entire site?
Cheers!
Not at all - if you don't need the read more link elsewhere, this code is safe for you to use :)