I created a custom post type in WordPress how I can add custom excerpt add a field in this. custom post type is saved in the same wp_posts table. and Add option show all the fields. But now I want to add custom excerpt field in this. I there any WordPress function to add an excerpt. anyone can help!
Change your support field to this 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ) );
I hope you have created the custom post type by adding the function register_post_type() in theme function.php file. If yes, you just update your code with 'supports'. Then go to Screen Options and click 'Excerpt'.
$args = array(
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type( 'book', $args );
Or you can also add the following code
add_action( 'init', 'my_add_excerpts_to_pages' );
function my_add_excerpts_to_pages() {
add_post_type_support( 'page', 'excerpt' ); //change page with your post type slug.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With