display_post_states WordPress Filter Hook

The display_post_states hook is a great way to add custom states to a post in the WordPress admin. This can be useful for indicating things like whether a post is featured, or if it has been updated recently.

apply_filters( 'display_post_states', string[] $post_states, WP_Post $post ) #

Filters the default post display states used in the posts list table.


Parameters

$post_states

(string[])An array of post display states.

$post

(WP_Post)The current post object.


Top ↑

Source

File: wp-admin/includes/template.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.5.0Also applied in the Customizer context. If any admin functions are used within the filter, their existence should be checked with function_exists() before being used.
3.6.0Added the $post parameter.
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.