Make WordPress Core

Opened 20 months ago

Last modified 20 months ago

#56691 new enhancement

Introduce a function 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 (1)

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


20 months ago
#1

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.