CCDzine
10/24/2017 - 12:15 AM

Add custom post states in WordPress

Add custom post states in WordPress

<?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');
    }
}