Make WordPress Core

Opened 2 years ago

Last modified 6 months ago

#56691 new enhancement

Function suggestion: get_excerpt_length()

Reported by: tremidkhar's profile tremidkhar Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:

Description

Currently, there is no way we can get the excerpt length whether the default or the filtered value.

This will be useful when developers in some way need to get the post excerpt length.

For now, developers can use something like the following to match the excerpt length with the of the site.

<?php
$excerpt_length = apply_filters( 'excerpt_length', 40 );

With the new function, developers don't have to remember to add the filter, they can just call the function and get the excerpt length that matches the rest of the site.

<?php
$excerpt_length = get_excerpt_length();

Change History (3)

This ticket was mentioned in PR #3367 on WordPress/wordpress-develop by TremiDkhar.


2 years ago
#1

  • Keywords has-patch added

#2 @tremidkhar
6 months ago

  • Summary changed from Introduce a function get excerpt length to Function suggestion: get_excerpt_length()

#3 @tremidkhar
6 months ago

Hello @SergeyBiryukov,

Can we have your thoughts on this, please?

Note: See TracTickets for help on using tickets.