Remove Read More Link
January 31, 2025 ยท AI Conversations
User
the_Excerpt remove read more
Assistant
If you want to remove the "Read More" link from `the_excerpt()` in WordPress, here are a few ways to do it:
### 1. **Filter `excerpt_more` Hook**
By default, WordPress appends `[…]` to excerpts, which some themes replace with "Read More." You can modify it by adding this to your theme's `functions.php`:
function custom_excerpt_more($more) {
return ''; // Removes the 'Read More' link
}
add_filter('excerpt_more', 'custom_excerpt_more');
### 2. **Modify `the_excerpt()` Directly in the Template**
If your theme adds a "Read More" link manually after `the_excerpt()`, remove or edit the code in the template file (`content.php`, `content-excerpt.php`, etc.).
Look for something like:
the_excerpt();
echo '<a href="' . get_permalink() . '">Read More</a>';
Simply remove the “ tag.
### 3. **Use `wp_trim_words()` Instead of `the_excerpt()`**
If `the_excerpt()` still adds "Read More," you can manually control the excerpt in your template:
echo wp_trim_words(get_the_content(), 40, ''); // Adjust word count if needed
Would you like me to check how your theme is handling excerpts?