Customizing the Excerpt More […] Text in WordPress with a Code Snippet

Excerpts in WordPress are a great way to preview a post or page without displaying the entire content. By default, WordPress automatically generates an excerpt with a “Read More” link at the end. You can easily change this link to suit your needs. In this article, we will show you how to change the “Read More” text using a code snippet.

The code snippet we will use is a WordPress filter, specifically the “excerpt_more” filter. Filters in WordPress allow you to modify or manipulate data in WordPress, such as post content, post titles, and in this case, excerpt more text.

Here is the code snippet that you can add to your WordPress site:

add_filter('excerpt_more', 'custom_excerpt_more');
function custom_excerpt_more($more)
{
    return '...';
}

This code does two things:

  1. Adds a filter to the “excerpt_more” with the function name “custom_excerpt_more”.
  2. Defines the function “custom_excerpt_more”, which takes one argument, “$more”. The function returns “…”, which is the new excerpt of more text.

Once you have added this code to your WordPress site, the excerpt more text for all posts and page previews will be “…”. You can change the value of “…” to any text you want, depending on how you want your excerpts to appear.

In conclusion, customizing the excerpt more text in WordPress is a simple and effective way to control the appearance of your post and page previews. Using the “excerpt_more” filter and a code snippet, you can change the excerpt-more […] text to any text you want, making it a powerful tool for customizing your WordPress site.

Read more from our blog

Customizing the Excerpt Length in WordPress with a Code Snippet

Excerpts in WordPress are a great way to preview a post or page without displaying the entire content. By default,…

Creating Custom Themes in WordPress: A Beginner’s Guide

WordPress is a powerful content management system that allows users to easily create and manage their own websites. One of…

Want to be a part of our team?

Lunover focuses on building strong relationships within our team and investing in our team members and clients to promote job satisfaction, happiness and success.

Checkout our Jobs