How to identify a post is NEW or we are editing an existing one?
How do we identify that we are on a NEW Post page or editing an existing one from within the code.
I checked with $post->ID it returns POST ID in case of new Post also.
开发者_StackOverflow社区Please suggest a solution.
Thanks in advance.
is it possible to use add_action such as:
function editing_flag(){
//set a flag to the post being edited
}
add_action('edit_post','editing_flag');
then in a single.php, you check if the flag is set like:
if(flag){
echo 'the post is being edited';
}
but remeber to unflag it when you are done editing. this is just an idea
精彩评论