-
-
Save ControlledChaos/f44bad6f6428d2f2e1ad6a475d1394b0 to your computer and use it in GitHub Desktop.
Add custom post states in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('display_post_states', 'wpsites_custom_post_states'); | |
function wpsites_custom_post_states($states) { | |
global $post; | |
if( ('page'==get_post_type($post->ID)) && ('page-templates/custom-page-template.php'==get_page_template_slug($post->ID)) ) { | |
$states[] = __('Custom state'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment