Last active
May 2, 2023 04:43
-
-
Save martijn94/484ef79ffbcb420549327454a746f88b to your computer and use it in GitHub Desktop.
Snippet to add post state to a WordPress page
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 post state to the projects page | |
//====================================================================== | |
add_filter( 'display_post_states', 'ecs_add_post_state', 10, 2 ); | |
function ecs_add_post_state( $post_states, $post ) { | |
if( $post->post_name == 'edit-profile' ) { | |
$post_states[] = 'Profile edit page'; | |
} | |
return $post_states; | |
} |
Works perfectly - used it in a plugin. Thanks.
Exactly what I needed, thank you!
Good work, Thank You
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks. I had tried it there and it didn't work, hence my question. But then between typing that and your reply it started working... think I had some mixed up branches!
Good work though. Exactly what I needed and working perfectly now.