need help with wordpress add_action init to recognise is_single

I have,

function my_function_init(){
    global $post;
    if(is_single()) {
        echo $post->ID;
    }
}
add_action('init', 'my_function_init');

this doesn’t work for me, it doesn’t recognize if its a post even if its a post (is_single() = checks if its a post), i have this in the plugin i am writing for wordpress, please help

Related posts

Leave a Reply

1 comment