How to add an excerpt to pages and custom post types in WordPress
Share
Is an excerpt not showing for pages?
Excerpts are not supported by default for pages (it’s only a default feature for posts). You will not find excerpts under ‘screen options’ – you have to add support with code. To add support simply add the snippet below to your functions.php file.
add_action('after_setup_theme', function () {
add_post_type_support('page', 'excerpt');
});
Add support for custom post types
When registering a custom post type, you can add the option to have excerpts with the ‘supports’ parameter. But if you want to add excerpt support for an existing custom post type and you don’t have access to the register script, use the same function as above but replacing ‘page’ with the slug name of your custom post type.
add_action('after_setup_theme', function () {
add_post_type_support('your-custom-post-type', 'excerpt');
});
Read more tutorials
How to Add ACF Filters to WordPress Feeds: A Step-by-Step Guide
Learn how to enhance your Query Loop Block by using custom Advanced Custom Fields (ACF) with the Filter Query Block Pro plugin.
Continue Reading How to Add ACF Filters to WordPress Feeds: A Step-by-Step Guide
Top 10 Must Have Code Snippets to Supercharge Your WordPress Site
Ten essential code snippets that you can add to your functions.php file to enhance your WordPress site
Continue Reading Top 10 Must Have Code Snippets to Supercharge Your WordPress Site
Understanding the WordPress Query Loop Block: What It Is and How to Use It
The Query Loop Block is a powerful feature in WordPress that allows users to display lists of posts or pages dynamically.
Continue Reading Understanding the WordPress Query Loop Block: What It Is and How to Use It